import Whop from '@whop/sdk';
const client = new Whop({
apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
});
const response = await client.users.checkAccess('resource_id', { id: 'user_xxxxxxxxxxxxx' });
console.log(response.access_level);{
"has_access": true,
"access_level": "no_access"
}Check whether a user has access to a specific resource, and return their access level.
import Whop from '@whop/sdk';
const client = new Whop({
apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
});
const response = await client.users.checkAccess('resource_id', { id: 'user_xxxxxxxxxxxxx' });
console.log(response.access_level);{
"has_access": true,
"access_level": "no_access"
}A company API key, company scoped JWT, app API key, or user OAuth token. You must prepend your key/token with the word 'Bearer', which will look like Bearer ***************************
The unique identifier or username of the user.
"user_xxxxxxxxxxxxx"
The unique identifier of the resource to check access for. Accepts a company, product, or experience identifier.
Was this page helpful?