Identity Tokens

Create Identity Token

Changed on

Creates 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.

post/access_tokens/identity

Request

  • Base URL
    https://api.whop.com/api/v1
  • Auth
    HTTP bearer

Headers

Api-Version-Date, string
Example:2026-11-30

Pins the request to a dated API version.

Idempotency-Key, string
Example:d9105228-4a08-46b1-8b91-42fed586d383

A unique key that makes this request safe to retry. See Idempotent requests.

Request body

object required
audience, string required

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

object required
expires_at, string date-time required

When the identity token expires, as an ISO 8601 timestamp.

token, string required

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