(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
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
use Clerk\Backend\Models\Operations;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();
$request = new Operations\CreatePhoneNumberRequestBody();
$response = $sdk->phoneNumbers->create(
request: $request
);
if ($response->phoneNumber !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\CreatePhoneNumberRequestBody | ✔️ | The request object to use for the request. |
?Operations\CreatePhoneNumberResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ClerkErrors7 | 400, 401, 403, 404, 422 | application/json |
Errors\SDKException | 4XX, 5XX | */* |
Returns the details of a phone number
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();
$response = $sdk->phoneNumbers->get(
phoneNumberId: '<id>'
);
if ($response->phoneNumber !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
phoneNumberId |
string | ✔️ | The ID of the phone number to retrieve |
?Operations\GetPhoneNumberResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ClerkErrors8 | 400, 401, 403, 404 | application/json |
Errors\SDKException | 4XX, 5XX | */* |
Delete the phone number with the given ID
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();
$response = $sdk->phoneNumbers->delete(
phoneNumberId: '<id>'
);
if ($response->deletedObject !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
phoneNumberId |
string | ✔️ | The ID of the phone number to delete |
?Operations\DeletePhoneNumberResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ClerkErrors9 | 400, 401, 403, 404 | application/json |
Errors\SDKException | 4XX, 5XX | */* |
Updates a phone number
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
use Clerk\Backend\Models\Operations;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();
$requestBody = new Operations\UpdatePhoneNumberRequestBody();
$response = $sdk->phoneNumbers->update(
phoneNumberId: '<id>',
requestBody: $requestBody
);
if ($response->phoneNumber !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
phoneNumberId |
string | ✔️ | The ID of the phone number to update |
requestBody |
?Operations\UpdatePhoneNumberRequestBody | ➖ | N/A |
?Operations\UpdatePhoneNumberResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ClerkErrors10 | 400, 401, 403, 404 | application/json |
Errors\SDKException | 4XX, 5XX | */* |