Create Identity Token
Changed onCreates a short-lived OIDC identity token for the app, account, or user that owns your API key. Send it to a service outside Whop to prove who is calling, with no shared secret. The runtime claim says where your code runs. It is whop when your app's server on Whop hosting created the token, and external for an API key used anywhere else. A whop token also has env, which is production for the live build and preview for any other build, and app_build_id, the build that runs. The sub claim joins these as key:value segments, from the runtime to the environment. An app on Whop hosting gets runtime:whop:account:biz_xxxxxxxxxxxxx:app:app_xxxxxxxxxxxxx:env:production. The same app's API key used anywhere else gets runtime:external:account:biz_xxxxxxxxxxxxx:app:app_xxxxxxxxxxxxx. An account API key gets runtime:external:account:biz_xxxxxxxxxxxxx, and a user API key gets runtime:external:user:user_xxxxxxxxxxxxx. A service that matches a subject by prefix must end the prefix on a full segment and its :. The account_id, app_id and user_id claims carry the same IDs one by one. The typ claim is always identity, which no other Whop token carries. The api_key_id claim is the API key that created the token. The iss claim is https://api.whop.com, and the service finds the signing keys through https://api.whop.com/.well-known/openid-configuration. Your app's server on Whop hosting can call this endpoint with no key of its own. A session, an OAuth token, or a token created from an API key cannot create an identity token.
Request
- Base URLhttps://api.whop.com/api/v1
- AuthHTTP bearer
Headers
Pins the request to a dated API version.
A unique key that makes this request safe to retry. See Idempotent requests.
Request body
The service that verifies the token, as that service names itself. It becomes the aud claim. The service must reject a token with another audience. It must be a URL or a hostname, such as https://database.example.com or sts.amazonaws.com.
Example request
{
"audience": "https://database.example.com"
}Response
an identity token was created
When the identity token expires, as an ISO 8601 timestamp.
The identity token, a signed JWT. Send it to the service named in audience.
Example response
{
"expires_at": "2026-01-01T12:00:00.000Z",
"token": "eyJhbGciOiJIUzI1NiJ9.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}Changes
- info
endpoint added
- info