(emailAddresses())
- create - Create an email address
- get - Retrieve an email address
- delete - Delete an email address
- update - Update an email address
Create a new email address
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.CreateEmailAddressRequestBody;
import com.clerk.backend_api.models.operations.CreateEmailAddressResponse;
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();
CreateEmailAddressRequestBody req = CreateEmailAddressRequestBody.builder()
.build();
CreateEmailAddressResponse res = sdk.emailAddresses().create()
.request(req)
.call();
if (res.emailAddress().isPresent()) {
// handle response
}
}
}
CreateEmailAddressResponse
Error Type |
Status Code |
Content Type |
models/errors/ClerkErrors |
400, 401, 403, 404, 422 |
application/json |
models/errors/SDKError |
4XX, 5XX |
*/* |
Returns the details of an email address.
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.GetEmailAddressResponse;
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();
GetEmailAddressResponse res = sdk.emailAddresses().get()
.emailAddressId("<id>")
.call();
if (res.emailAddress().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
emailAddressId |
String |
✔️ |
The ID of the email address to retrieve |
GetEmailAddressResponse
Error Type |
Status Code |
Content Type |
models/errors/ClerkErrors |
400, 401, 403, 404 |
application/json |
models/errors/SDKError |
4XX, 5XX |
*/* |
Delete the email address with the given ID
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.DeleteEmailAddressResponse;
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();
DeleteEmailAddressResponse res = sdk.emailAddresses().delete()
.emailAddressId("<id>")
.call();
if (res.deletedObject().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
emailAddressId |
String |
✔️ |
The ID of the email address to delete |
DeleteEmailAddressResponse
Error Type |
Status Code |
Content Type |
models/errors/ClerkErrors |
400, 401, 403, 404 |
application/json |
models/errors/SDKError |
4XX, 5XX |
*/* |
Updates an email address.
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.UpdateEmailAddressRequestBody;
import com.clerk.backend_api.models.operations.UpdateEmailAddressResponse;
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();
UpdateEmailAddressResponse res = sdk.emailAddresses().update()
.emailAddressId("<id>")
.requestBody(UpdateEmailAddressRequestBody.builder()
.build())
.call();
if (res.emailAddress().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
emailAddressId |
String |
✔️ |
The ID of the email address to update |
requestBody |
UpdateEmailAddressRequestBody |
✔️ |
N/A |
UpdateEmailAddressResponse
Error Type |
Status Code |
Content Type |
models/errors/ClerkErrors |
400, 401, 403, 404 |
application/json |
models/errors/SDKError |
4XX, 5XX |
*/* |