sk_* API key client-side. See JWT Public Keys for how to create and manage keys.
Wire Format
Every request requires two credentials: yourpk_jwt_* key (hardcoded in your app) and the user’s JWT (obtained at login).
REST
WebSocket
Auth Flow
Key lookup
The
pk_jwt_ prefix triggers the JWT public key auth flow. The key record is loaded from the database (cached 60 seconds). If the key is disabled or not found, the request returns 401.JWT verification
JWKS URL keys: The JWKS is fetched from the configured URL (cached 5 minutes). If the JWT’s
kid is not found in the cached set, the JWKS is re-fetched once to handle key rotation.Inline public key: The PEM or JWK JSON key is used directly to verify the JWT signature.Supported algorithms: RS256, RS384, RS512, ES256, ES384, EdDSA.Claims validation
aud and iss claims are validated if configured on the key. If the JWT is expired or the signature is invalid, the request returns 401.Rate limiting and billing
The
sub claim is extracted as the session identifier. The parent API key’s rate limit and credit cap apply. If per_session_rpm is set, an additional per-user rate limit is checked (keyed on pk_jwt_xxx:sub).Supported Algorithms
Only asymmetric JWT signing algorithms are supported:| Family | Algorithms |
|---|---|
| RSA | RS256, RS384, RS512 |
| Elliptic Curve | ES256, ES384 |
| Edwards Curve | EdDSA |
Key Verification Methods
JWKS URL
Provide a JWKS endpoint URL and Struct will fetch the public keys automatically. This is the standard approach for most auth providers. The JWKS is cached for 5 minutes, and if a JWT arrives with an unknownkid, the JWKS is re-fetched once to handle key rotation.
Inline Public Key
Alternatively, provide the public key directly in PEM format (-----BEGIN PUBLIC KEY-----) or as JWK JSON ({"kty":"RSA", ...}). The key is used directly to verify JWT signatures without any external fetch.