(jwt_templates)
- list - List all templates
- create - Create a JWT template
- get - Retrieve a template
- update - Update a JWT template
- delete - Delete a Template
List all templates
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.jwt_templates.list()
assert res is not None
# Handle response
print(res)
Parameter |
Type |
Required |
Description |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
List[models.JWTTemplate]
Error Type |
Status Code |
Content Type |
models.SDKError |
4XX, 5XX |
*/* |
Create a new JWT template
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.jwt_templates.create(request={
"name": "Example Template",
"claims": {},
"lifetime": 3600,
"allowed_clock_skew": 5,
"custom_signing_key": False,
"signing_algorithm": "RS256",
"signing_key": "PRIVATE_KEY_PLACEHOLDER",
})
assert res is not None
# Handle response
print(res)
models.JWTTemplate
Error Type |
Status Code |
Content Type |
models.ClerkErrors |
400, 402, 422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Retrieve the details of a given JWT template
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.jwt_templates.get(template_id="template_123")
assert res is not None
# Handle response
print(res)
Parameter |
Type |
Required |
Description |
Example |
template_id |
str |
✔️ |
JWT Template ID |
template_123 |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
|
models.JWTTemplate
Error Type |
Status Code |
Content Type |
models.ClerkErrors |
404 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Updates an existing JWT template
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.jwt_templates.update(template_id="<id>", name="<value>", claims={}, lifetime=8574.77, allowed_clock_skew=5971.29, custom_signing_key=True, signing_algorithm="<value>", signing_key="<value>")
assert res is not None
# Handle response
print(res)
Parameter |
Type |
Required |
Description |
template_id |
str |
✔️ |
The ID of the JWT template to update |
name |
Optional[str] |
➖ |
JWT template name |
claims |
Optional[models.UpdateJWTTemplateClaims] |
➖ |
JWT template claims in JSON format |
lifetime |
OptionalNullable[float] |
➖ |
JWT token lifetime |
allowed_clock_skew |
OptionalNullable[float] |
➖ |
JWT token allowed clock skew |
custom_signing_key |
Optional[bool] |
➖ |
Whether a custom signing key/algorithm is also provided for this template |
signing_algorithm |
OptionalNullable[str] |
➖ |
The custom signing algorithm to use when minting JWTs |
signing_key |
OptionalNullable[str] |
➖ |
The custom signing private key to use when minting JWTs |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.JWTTemplate
Error Type |
Status Code |
Content Type |
models.ClerkErrors |
400, 402, 422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Delete a Template
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.jwt_templates.delete(template_id="<id>")
assert res is not None
# Handle response
print(res)
Parameter |
Type |
Required |
Description |
template_id |
str |
✔️ |
JWT Template ID |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.DeletedObject
Error Type |
Status Code |
Content Type |
models.ClerkErrors |
403, 404 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |