Skip to main content

Request permissions

1

Go to your app's permissions settings

  1. Go to the developer dashboard
  2. Create a new app or select an existing one
  3. Click on Permissions
Permissions Settings
2

Add permissions

  1. Click on Add permissions
  2. Select the permissions you want to add
  3. Confirm by clicking Add
3

Configure each permission

  1. Write a short explanation for why your app needs the permission
  2. Choose whether the permission is required or optional
Permissions Justification
4

Save your permissions

Save Permissions Settings
Creators will now need to approve the permissions you requested before installing your app:
Permissions Prompt

Configure your permissions

You can update your currently granted permissions or re-approve them in your Authorized apps settings. To manually navigate to the settings, go to: Dashboard -> Settings -> Authorized apps

Configure your SDK

Update your SDK configuration by removing the onBehalfOfUserId and companyId properties.
lib/whop-sdk.ts
import { WhopServerSdk } from "@whop/api";

export const whopSdk = WhopServerSdk({
	// Add your app id here - this is required.
	// You can get this from the Whop dashboard after creating an app section.
	appId: process.env.NEXT_PUBLIC_WHOP_APP_ID ?? "fallback",

	// Add your app api key here - this is required.
	// You can get this from the Whop dashboard after creating an app section.
	appApiKey: process.env.WHOP_API_KEY ?? "fallback",

	// This will make api requests on behalf of this user.
	// This is optional, however most api requests need to be made on behalf of a user.
	// You can create an agent user for your app, and use their userId here.
	// You can also apply a different userId later with the `withUser` function.
	onBehalfOfUserId: process.env.NEXT_PUBLIC_WHOP_AGENT_USER_ID,

	// This is the companyId that will be used for the api requests.
	// When making api requests that query or mutate data about a company, you need to specify the companyId.
	// This is optional, however if not specified certain requests will fail.
	// This can also be applied later with the `withCompany` function.
	companyId: process.env.NEXT_PUBLIC_WHOP_COMPANY_ID,
});

Examples

Get a member’s email address

  const member = await whopSdk.companies.getMember({
    companyId: "biz_***",
    companyMemberId: "mber_***",
  });

  // Without member:basic:read
  // ^? null

  // With member:basic:read
  // ^? { user: { id: "user_***", email: null, ... }, ... }

  // With member:basic:read & member:email:read
  // ^? { user: { id: "user_***", email: "***@gmail.com", ... }, ... }

FAQ

You can request as many permissions as you want.
You can find the required permissions for each SDK method documented in the SDK reference.
SDK Reference Permissions
Yes. You can request additional permissions and the creator will be asked to re-approve them.
Keep in mind that until the permissions are re-approved, API requests requiring the newly requested permissions will fail. Make sure to handle these errors gracefully in your code.
When developing your app, make sure you re-approve the permissions yourself in your Authorized apps settings.See Configure your permissions for more information.
I