(PhoneNumbers)
- Create - Create a phone number
- Get - Retrieve a phone number
- Delete - Delete a phone number
- Update - Update a phone number
Create a new phone number
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Operations;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
CreatePhoneNumberRequestBody req = new CreatePhoneNumberRequestBody() {
UserId = "usr_12345",
PhoneNumber = "+11234567890",
Verified = true,
Primary = false,
ReservedForSecondFactor = false,
};
var res = await sdk.PhoneNumbers.CreateAsync(req);
// handle response
CreatePhoneNumberResponse
Error Type |
Status Code |
Content Type |
Clerk.BackendAPI.Models.Errors.ClerkErrors |
400, 401, 403, 404, 422 |
application/json |
Clerk.BackendAPI.Models.Errors.SDKError |
4XX, 5XX |
*/* |
Returns the details of a phone number
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Operations;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.PhoneNumbers.GetAsync(phoneNumberId: "phone_12345");
// handle response
Parameter |
Type |
Required |
Description |
Example |
PhoneNumberId |
string |
✔️ |
The ID of the phone number to retrieve |
phone_12345 |
GetPhoneNumberResponse
Error Type |
Status Code |
Content Type |
Clerk.BackendAPI.Models.Errors.ClerkErrors |
400, 401, 403, 404 |
application/json |
Clerk.BackendAPI.Models.Errors.SDKError |
4XX, 5XX |
*/* |
Delete the phone number with the given ID
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Operations;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.PhoneNumbers.DeleteAsync(phoneNumberId: "phone_12345");
// handle response
Parameter |
Type |
Required |
Description |
Example |
PhoneNumberId |
string |
✔️ |
The ID of the phone number to delete |
phone_12345 |
DeletePhoneNumberResponse
Error Type |
Status Code |
Content Type |
Clerk.BackendAPI.Models.Errors.ClerkErrors |
400, 401, 403, 404 |
application/json |
Clerk.BackendAPI.Models.Errors.SDKError |
4XX, 5XX |
*/* |
Updates a phone number
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Operations;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.PhoneNumbers.UpdateAsync(
phoneNumberId: "phone_12345",
requestBody: new UpdatePhoneNumberRequestBody() {
Verified = false,
Primary = true,
ReservedForSecondFactor = true,
}
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
PhoneNumberId |
string |
✔️ |
The ID of the phone number to update |
phone_12345 |
RequestBody |
UpdatePhoneNumberRequestBody |
✔️ |
N/A |
|
UpdatePhoneNumberResponse
Error Type |
Status Code |
Content Type |
Clerk.BackendAPI.Models.Errors.ClerkErrors |
400, 401, 403, 404 |
application/json |
Clerk.BackendAPI.Models.Errors.SDKError |
4XX, 5XX |
*/* |