- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
04-21-2026 03:38 PM
I need to update the platform of an account via RestAPI. The new platform does belong to a different device type than the old platform.
I'm trying this in powershell but I keep getting an error 400.
"function Set-PlatformId {
param(
[Parameter(Mandatory)]
[string]$AccountId,
[Parameter(Mandatory)]
[string]$PlatformId
)
$accountIdTrim = $AccountId.Trim()
$platformIdTrim = $PlatformId.Trim()
$apiUrl = "$PCloudURL/API/Accounts/$accountIdTrim"
$body = @(
@{
op = "replace"
path = "/platformID"
value = "NewPlatFormName"
}
) | ConvertTo-Json
if ($body[0] -ne '[') {
$body = "[" + $body + "]"
}
Write-DebugMsg "Trying platformId-only PATCH"
Write-DebugMsg "URI: $apiUrl"
Write-DebugMsg "Body: $body"
Invoke-RestMethod `
-Uri $apiUrl `
-Method Patch `
-Headers $headers `
-Body $body `
-ContentType "application/json" | Out-Null
}"
04-23-2026 12:16 AM
Check the response body, it should tell you why the API rejected the request.
$Result = Invoke-RestMethod ....
Write-Host $ResultA common error happens when you want to change an account's platform to a new platform that has a different "Device Type" - see: https://community.cyberark.com/s/question/0D52J000096sesoSAA/how-to-move-an-account-to-a-different-platform-its-not-letting-me
As far as I can tell, there is no way to do this via REST API in PrivCloud, as of right now.
04-21-2026 04:20 PM
Take a look at your $body. Might want to simplify. I would eliminate the ConvertTo-Json and array notation. @( )
$body = {
"op" : "replace"
"path" : "/platformID"
"value" : "NewPlatformName"
}
See if that helps. Do a web search for REST API body json Plenty out there to help.
04-22-2026 06:05 AM
I updated my script to the below, unfortunately same error.
function Set-PlatformId {
param(
[Parameter(Mandatory)]
[string]$AccountId,
[Parameter(Mandatory)]
[string]$PlatformId
)
$uri = "$PCloudURL/API/Accounts/$AccountId"
$body = '[{"op":"replace","path":"/platformId","value":"' + $PlatformId + '"}]'
Write-Host "PATCH $uri"
Write-Host "Body: $body" -ForegroundColor Cyan
Invoke-RestMethod -Uri $uri -Method Patch -Headers @{
Authorization = $headers.Authorization
"Content-Type" = "application/json"
} -Body $body
}
04-23-2026 12:16 AM
Check the response body, it should tell you why the API rejected the request.
$Result = Invoke-RestMethod ....
Write-Host $ResultA common error happens when you want to change an account's platform to a new platform that has a different "Device Type" - see: https://community.cyberark.com/s/question/0D52J000096sesoSAA/how-to-move-an-account-to-a-different-platform-its-not-letting-me
As far as I can tell, there is no way to do this via REST API in PrivCloud, as of right now.
04-23-2026 05:36 AM
Yup, found that out yesterday. You can only change device type on v1 and that only works for on-prem unfortunately. Thanks everyone for the insight.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!

