```javascript Next.js
import { whopApi } from "@/lib/whop-api";
import { verifyUserToken } from "@whop/api";
import { headers } from "next/headers";
// The headers contains the user token
const headersList = await headers();
// The experienceId is a path param
// This can be configured in the Whop Dashboard, when you define your app
const { experienceId } = await params;
// The user token is in the headers
const { userId } = await verifyUserToken(headersList);
const result = await whopApi.checkIfUserHasAccessToExperience({
userId,
experienceId,
});
if (!result.hasAccessToExperience.hasAccess) {
return You do not have access to this experience
;
}
// Either: 'admin' | 'customer' | 'no_access';
// 'admin' means the user is an admin of the whop, such as an owner or moderator
// 'customer' means the user is a common member in this whop
// 'no_access' means the user does not have access to the whop
const { accessLevel } = result.hasAccessToExperience;
if (accessLevel === "admin") {
return You are an admin of this experience
;
}
if (accessLevel === "customer") {
return You are a customer of this experience
;
}
return You do not have access to this experience
```
# Set up the API client
Source: https://dev.whop.com/sdk/whop-api-client
We provide a TS client that makes it super easy to use our API. We highly recommend you use this client.
Our SDK makes it simple to use our API. It's a wrapper around our GraphQL API with pre-built functions for all of our endpoints. The endpoints are outlined in the SDK reference section of our docs.
### Install