(jwtTemplates())
- 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
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.operations.ListJWTTemplatesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Clerk sdk = Clerk.builder()
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
.build();
ListJWTTemplatesResponse res = sdk.jwtTemplates().list()
.call();
if (res.jwtTemplateList().isPresent()) {
// handle response
}
}
}
ListJWTTemplatesResponse
Error Type |
Status Code |
Content Type |
models/errors/SDKError |
4XX, 5XX |
*/* |
Create a new JWT template
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.CreateJWTTemplateRequestBody;
import com.clerk.backend_api.models.operations.CreateJWTTemplateResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
.build();
CreateJWTTemplateRequestBody req = CreateJWTTemplateRequestBody.builder()
.build();
CreateJWTTemplateResponse res = sdk.jwtTemplates().create()
.request(req)
.call();
if (res.jwtTemplate().isPresent()) {
// handle response
}
}
}
CreateJWTTemplateResponse
Error Type |
Status Code |
Content Type |
models/errors/ClerkErrors |
400, 402, 422 |
application/json |
models/errors/SDKError |
4XX, 5XX |
*/* |
Retrieve the details of a given JWT template
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.GetJWTTemplateResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
.build();
GetJWTTemplateResponse res = sdk.jwtTemplates().get()
.templateId("<id>")
.call();
if (res.jwtTemplate().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
templateId |
String |
✔️ |
JWT Template ID |
GetJWTTemplateResponse
Error Type |
Status Code |
Content Type |
models/errors/ClerkErrors |
404 |
application/json |
models/errors/SDKError |
4XX, 5XX |
*/* |
Updates an existing JWT template
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.UpdateJWTTemplateRequestBody;
import com.clerk.backend_api.models.operations.UpdateJWTTemplateResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
.build();
UpdateJWTTemplateResponse res = sdk.jwtTemplates().update()
.templateId("<id>")
.requestBody(UpdateJWTTemplateRequestBody.builder()
.build())
.call();
if (res.jwtTemplate().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
templateId |
String |
✔️ |
The ID of the JWT template to update |
requestBody |
UpdateJWTTemplateRequestBody |
✔️ |
N/A |
UpdateJWTTemplateResponse
Error Type |
Status Code |
Content Type |
models/errors/ClerkErrors |
400, 402, 422 |
application/json |
models/errors/SDKError |
4XX, 5XX |
*/* |
Delete a Template
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.DeleteJWTTemplateResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
.build();
DeleteJWTTemplateResponse res = sdk.jwtTemplates().delete()
.templateId("<id>")
.call();
if (res.deletedObject().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
templateId |
String |
✔️ |
JWT Template ID |
DeleteJWTTemplateResponse
Error Type |
Status Code |
Content Type |
models/errors/ClerkErrors |
403, 404 |
application/json |
models/errors/SDKError |
4XX, 5XX |
*/* |