Skip to main content
Mint JWT is in beta and is enabled per organization. Contact sales to turn it on.
Mint JWT lets your service rely on Turnkey’s policy engine to decide who may call it. A user asks Turnkey to sign a JWT for one HTTP request. Turnkey applies your policies, including any approvals they require, and returns a token that your service verifies with Turnkey’s public keys. The token is bound to one exact request: method, path, query, chosen headers, and body. It can’t be reused for a different request, and it expires within five minutes.

How it works

  1. Your client builds the HTTP request it wants to send, then submits ACTIVITY_TYPE_MINT_JWT with a digest of that request.
  2. Turnkey evaluates your policies. If they need more approvals, the activity waits for them.
  3. Turnkey signs the JWT with ES256 and returns it.
  4. Your client sends the request with the JWT in the header. Your service checks the signature and that the token matches the request.

Who can mint

Your policies decide who can mint and who must approve. As with any activity, the root quorum can mint without a policy, and every other user needs one.
The jwt.profile.httpz.audience, jwt.profile.httpz.method, and jwt.profile.httpz.path policy fields are coming soon.
A trading service can mint order tokens on its own:
Withdrawal tokens also need two administrators:

Mint a token

To bind headers too, add headerNames and one headerDigest per name. You can’t bind authorization or hop-by-hop headers. See the Mint JWT API reference for every field.

Token claims

The turnkey.io/http-authz/v1 profile produces these claims:

Verify a token

Your service checks each request:
  1. Signature. Verify the ES256 signature with the key from https://id.turnkey.com/t/<organization ID>/jwks.json. Use the organization ID from iss.
  2. Issuer and audience. iss is an organization you trust, and aud is your own origin.
  3. Time. exp is in the future.
  4. Request. The method, path, query, header digests, and body digest match the request you received.
  5. Subject. sub and org are a user and organization allowed to make this request.
A token stays valid until it expires. To stop replays, reject a token you have already accepted until its exp passes. In Rust, turnkey_jwt_profiles runs all of these checks, with an optional axum middleware. The source is in tkhq/rust-sdk.

Next steps