Unable to push/update Zoom Phone User Calling Plan

Hello everyone,

This is my first time posting, and I’m having some trouble with getting a specific API connection/push/update going and I’m needing some assistance. Details below.

API Endpoint(s) and/or Zoom API Event(s)
/phone/users/[userid]/calling_plans

Description
I am trying to develop a PowerShell script to update a user’s Zoom Phone Calling plan from Basic to US/CA Unlimited Calling plan. This is going through an OAuth2.0 custom app token in our environment.

I have reviewed the API documentation on Zoom’s website, as well as a few other variations I’ve seen in other forum posts and even tested some details provided by GitHub Copilot. I keep receiving a bad request error from the server, even though I’ve confirmed I can use the same endpoint to pull the current user information.

Error?
The remote server returned an error: (400) Bad Request.

How To Reproduce
Here is my current code attempt to identify the proper details needed to pass this request:

*# Step 5: Assign the US/CA Unlimited Calling Plan to the user
$callingPlanEndpoint = “https://api.zoom.us/v2/phone/users/$ZoomUserID/calling_plans
$callingPlanBody = @{
type=200
#name = “US/CA Unlimited Calling”
} | ConvertTo-Json -Depth 2

try {
    $response = Invoke-WebRequest -Method POST -Uri $callingPlanEndpoint -Headers $apiHeaders -Body $callingPlanBody
    Write-Host "Successfully assigned US/CA Unlimited Calling Plan to user $LogonID." -ForegroundColor Green
} catch {
    Write-Host "Failed to assign US/CA Unlimited Calling Plan to user $LogonID." -ForegroundColor Red
    Write-Host $_.Exception.Message
}

I’ve seen different sources each indicate requirements for the necessary Body data. I’ve seen in some cases, only the type value being required, in other it asks for both source_type and target_type. I’ve had no success in any case.

I have other logic to confirm the user information is being identified / passed successfully, and my authentication token is correct. I’m not sure what I may be doing wrong here.

Any help is greatly appreciated!

Thank you,

I don’t know powershell, but by the looks of it, it’s your callingplanbody. The schema is an array of calling plans, and the billing_account_id if required (you don’t need that one since you’re not in india).
So the data you’re actually posting should look like:
{“calling_plans”: [{“type”:200}]}

1 Like