Whop API
Use the SDK to use our API and return it in a formatted JSON response
The API SDK allows you to interact with the Whop API without having to manually write the requests. All responses are typed which gives you type safety.
The SDK has 3 functions, app
, company
, and me
. These dictate what namespace to use. From here, you will be able to select which type of request you are sending, such as GET
or POST
. You will then need to pass the route you are requesting, and the parameters.
The parameters object is typed, so you will be able to see what parameters are available for each endpoint.
For example, if you wanted to use the /companies/{id}
endpoint, you would pass the following parameters object:
App Mode
When you are using one of the App endpoints, you need to use this mode. This will use the app’s API key to make requests, which can either be set in the environment variables, as WHOP_API_KEY
, or passed in manually, like so:
Usage
Company Mode
When you are using one of the Company endpoints, you need to use this mode. This will use the company’s API key to make requests, which can either be set in the environment variables, as WHOP_API_KEY
, or passed in manually, like so:
Usage
Me Mode
When you are using one of the Me endpoints, you need to use this mode. This will use a user’s access token. This can be retrieved by using the /token endpoint, or if you are building an app, it can be retrieved from the whop_user_token
cookie.
You either need to pass in the token manually, or you can pass in the headers
.
Headers Usage
Token Usage
Was this page helpful?