Unable to assign Desk Phone to users via API

API Documentation:

Specific API Endpoint: https://api.zoom.us/v2/phone/devices/$deviceID/extensions

Description
I’ve created a PowerShell function Add-DeskPhone to allow our support staff access to assign our company’s standard desk phone, an AudioCodes C450HD IP Phone, to our Zoom Phone users via the API.

The function takes the user’s LogonID (AD SamAccountName) and the desk phone device MAC address to be assigned, checks that both exist in Zoom Phone, then tries to assign the device to the user.

Error?
I’m not receiving an error - on the contrary, I’m receiving a confirmation that the assignment was completed in PowerShell, but the portal does not reflect this / show the device assigned to the user.

Here’s the overall output, with extra info for verification/testing:

However, no assignment actually happens in the portal:

How To Reproduce
I’m including the entirety of my function here for reference. The only external reference is a call to get our Zoom Access Token, which could be easily replaced for testing. I am absolutely baffled by what could be going wrong here/why it is not working, and I need some help, please!

Any assistance would be greatly appreciated - thank you!

function Add-DeskPhone {
    <#
    .SYNOPSIS
    Assigns an AudioCodes c450hd Desk Phone (by MAC address) to a user in Zoom.

    .PARAMETER LogonID
    The user's LogonID (SamAccountName).

    .PARAMETER DeviceMAC
    The MAC address of the AudioCodes c450hd desk phone to assign (e.g., "A1B2C3D4E5F6" or "A1:B2:C3:D4:E5:F6" or "A1-B2-C3-D4-E5-F6").

    .EXAMPLE
    Add-DeskPhone -LogonID "HINES_RJ" -DeviceMAC "A1B2C3D4E5F6"
    #>
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [string]$LogonID,
        [Parameter(Mandatory = $true)]
        [string]$DeviceMAC
    )

    # Step 1: Get user email from AD
    try {
        $User = Get-ADUser -Filter { SamAccountName -eq $LogonID } -Properties EmailAddress
        if (-not $User) {
            Write-Host "No user found with LogonID: $LogonID" -ForegroundColor Red
            return
        }
        # Store the email address for later use
        $EmailAddress = $User.EmailAddress
    } catch {
        Write-Host "Error retrieving user email address for LogonID: $LogonID" -ForegroundColor Red
        Write-Host $_.Exception.Message
        return
    }

    # Step 2: Get Zoom access token
    $ZoomAccessToken = _Get-ZoomAccessToken
    if (-not $ZoomAccessToken) {
        Write-Host "Failed to retrieve Zoom access token." -ForegroundColor Red
        return
    }

    # Set up API headers for Zoom API requests
    $apiHeaders = @{
        "Authorization" = "Bearer $ZoomAccessToken"
        "Content-Type"  = "application/json"
    }

    # Step 3: Get Zoom Phone User record by email address, then retrieve their Zoom Phone User ID and Site ID
    $phoneUserEndpoint = "https://api.zoom.us/v2/phone/users/$EmailAddress"
    try {
        $phoneUserResponse = Invoke-WebRequest -Method GET -Uri $phoneUserEndpoint -Headers $apiHeaders
        $phoneUserDetails = $phoneUserResponse.Content | ConvertFrom-Json
        $ZoomPhoneUserID = $phoneUserDetails.id
        $UserSiteID = $phoneUserDetails.site.id
    } catch {
        Write-Host "Failed to retrieve Zoom Phone User ID for $EmailAddress" -ForegroundColor Red
        Write-Host $_.Exception.Message
        return
    }

    # Step 4: Find the unassigned AudioCodes C450HD device with the given MAC address
    # Normalize the MAC address input for comparison, removing dashes or colons and converting to uppercase
    $normalizedInputMAC = ($DeviceMAC -replace "[:-]", "").ToUpper().Trim()
    # Create a list to hold all unassigned devices
    $allDevices = @()
    $nextPageToken = $null
    
    # Loop through the paginated API results to find the unassigned device
    do {
        $uri = if ($nextPageToken) {
            "https://api.zoom.us/v2/phone/devices?page_size=100&type=unassigned&next_page_token=$nextPageToken"
        } else {
            "https://api.zoom.us/v2/phone/devices?page_size=100&type=unassigned"
        }
        try {
            # Invoke the API to get unassigned devices
            $response = Invoke-WebRequest -Method GET -Uri $uri -Headers $apiHeaders

            # Convert the response content from JSON to PowerShell objects
            $data = $response.Content | ConvertFrom-Json

            # Write the number of devices retrieved and the next page token
            if ($data.devices) {
                $allDevices += $data.devices
            }
            $nextPageToken = $data.next_page_token
        } catch {
            Write-Host "Error retrieving unassigned devices:" -ForegroundColor Red
            Write-Host $_.Exception.Message
            return
        }
    } while ($nextPageToken)

    # Filter the devices to find the one with the matching MAC address and type
    $device = $allDevices | Where-Object {
        ($_.mac_address -replace "[:-]", "").ToUpper().Trim() -eq $normalizedInputMAC -and
        $_.device_type -like "*C450HD*"
    }

    # If no device is found, notify the user and exit
    if (-not $device) {
        Write-Host "No unassigned AudioCodes C450HD device found with MAC ($normalizedInputMAC)." -ForegroundColor Red
        return
    }

    # Create a variable to hold the returned device ID
    $deviceID = $device.id

    # Output some logging information before the final assignment
    Write-Host "Device Type: $($deviceDetails.type)" -ForegroundColor Cyan
    Write-Host "Device ID: $deviceID" -ForegroundColor Cyan
    Write-Host "User Extension ID: $ZoomPhoneUserID" -ForegroundColor Cyan
    
    # Zoom sometimes takes a while after the move to process / register the device as a valid target. Give it a few seconds before continuing.
    Start-Sleep -Seconds 5

    # Step 6: Assign the device to the user
    $assignBody = @{
        "extension_ids"             = @($ZoomPhoneUserID)
        "site_id"                   = $UserSiteID
    } | ConvertTo-Json

    try {
        # Invoke the API to assign the device to the user, suppress the normal status code output in console
        $assignRequest = Invoke-WebRequest -Method POST -Uri "https://api.zoom.us/v2/phone/devices/$deviceID/extensions" -Headers $apiHeaders -Body $assignBody -ContentType "application/json" -ErrorAction Stop
        Write-Host "Status Code Response: $($assignRequest.StatusCode)" -ForegroundColor Yellow
        # Check the status code of the response to determine appropriate success or failure language
        if ($assignRequest.StatusCode -eq 204 -or $assignRequest.StatusCode -eq 200 -or $assignRequest.StatusCode -eq 201) {
            Write-Host "Successfully assigned AudioCodes C450HD device MAC: ($DeviceMAC) to user ($LogonID)." -ForegroundColor Green
        } else {
            Write-Host "Unexpected response assigning device: $($assignRequest.StatusCode)" -ForegroundColor Yellow
        }
    } catch {
        Write-Host "Failed to assign device with MAC: ($DeviceMAC) to user ($LogonID)." -ForegroundColor Red
        Write-Host $_.Exception.Message
    }
}