- 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(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
ListJWTTemplatesResponse res = sdk.jwtTemplates().list()
.limit(10L)
.offset(0L)
.call();
if (res.jwtTemplateList().isPresent()) {
System.out.println(res.jwtTemplateList().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
paginated |
Optional<Boolean> | ➖ | Whether to paginate the results. If true, the results will be paginated. If false, the results will not be paginated. |
limit |
Optional<Long> | ➖ | Applies a limit to the number of results returned. Can be used for paginating the results together with offset. |
offset |
Optional<Long> | ➖ | Skip the first offset results when paginating.Needs to be an integer greater or equal to zero. To be used in conjunction with limit. |
| 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.CreateJWTTemplateResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
CreateJWTTemplateResponse res = sdk.jwtTemplates().create()
.call();
if (res.jwtTemplate().isPresent()) {
System.out.println(res.jwtTemplate().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
request |
CreateJWTTemplateRequestBody | ✔️ | The request object to use for the request. |
| 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(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
GetJWTTemplateResponse res = sdk.jwtTemplates().get()
.templateId("<id>")
.call();
if (res.jwtTemplate().isPresent()) {
System.out.println(res.jwtTemplate().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
templateId |
String | ✔️ | JWT Template ID |
| 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.UpdateJWTTemplateResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
UpdateJWTTemplateResponse res = sdk.jwtTemplates().update()
.templateId("<id>")
.call();
if (res.jwtTemplate().isPresent()) {
System.out.println(res.jwtTemplate().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
templateId |
String | ✔️ | The ID of the JWT template to update |
requestBody |
Optional<UpdateJWTTemplateRequestBody> | ➖ | N/A |
| 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(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
DeleteJWTTemplateResponse res = sdk.jwtTemplates().delete()
.templateId("<id>")
.call();
if (res.deletedObject().isPresent()) {
System.out.println(res.deletedObject().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
templateId |
String | ✔️ | JWT Template ID |
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/ClerkErrors | 403, 404 | application/json |
| models/errors/SDKError | 4XX, 5XX | */* |