POST/jwt_templates

Create a JWT template

Creates a JWT template with the supplied name and claims. Include name and claims; set lifetime and allowed_clock_skew within their permitted ranges, and provide a signing algorithm and key when custom_signing_key is true. The response returns the created template.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

7 body fields

JWT template configuration. name and claims are required.

namestringrequired
JWT template name
claimsobjectrequired
JWT template claims in JSON format
lifetimeintegeroptional
JWT lifetime
allowed_clock_skewintegeroptional
JWT allowed clock skew
custom_signing_keybooleanoptional
Whether a custom signing key/algorithm is also provided for this template
signing_algorithmstringoptional
The custom signing algorithm to use when minting JWTs. Required if `custom_signing_key` is `true`.
signing_keystringoptional
The custom signing private key to use when minting JWTs. Required if `custom_signing_key` is `true`.

4 status codes
200Returns the created JWT template, including its ID, claims, lifetime, signing settings, and creation and update timestamps.
objectstringrequired
Allowed:jwt_template
idstringrequired
namestringrequired
claimsobjectrequired
lifetimeintegerrequired
allowed_clock_skewintegerrequired
custom_signing_keybooleanrequired
signing_algorithmstringrequired
created_atintegerrequired
Unix timestamp of creation.
updated_atintegerrequired
Unix timestamp of last update.
400Returned when the request is unsuccessful.
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional
402Returned when payment is required.
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional
422Returned when request parameters are invalid.
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional

Error handling

A 400 is returned when the request is unsuccessful; a 402 indicates payment is required; a 422 indicates invalid request parameters. name and claims are required; lifetime must be between 30 and 315360000, and allowed_clock_skew must be between 0 and 300. When custom_signing_key is true, provide signing_algorithm and signing_key.