cannot access the api

I created private app with full scopt and got the API Key
I want to disable user using script and using following script to access hubspot

$headers = @{
"Authorization" = "Bearer apikey"
}

# Replace '123' with the actual ownerId you want to update.
$ownerId = "xxxxxxxxxxxx"

# Construct the URL with the ownerId parameter in the path.
$url = "https://api.hubapi.com/owners/v2/owners/update/xxxxxxxxxx"

$response = Invoke-RestMethod -Uri $url -Headers $headers -Method Put

but I get error message

Invoke-RestMethod : The remote server returned an error: (404) Not Found.
At line:11 char:13
+ $response = Invoke-RestMethod -Uri $url -Headers $headers -Method Put
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Can anyone help me to reosolve the issue

Hi @Sadi2023

I think you are looking for the User Provisioning API /settings/v3/users/{userId} rather than the Owners API . /owners/v2/owners/update/

Have a look at this page.

Have fun

Mike

Here to learn more about HubSpot and share my HubSpot Knowledge. I’m the founder of Webalite a HubSpot Partner Agency based in Wellington, New Zealand and the founder of Portal-iQ the world’s first automated HubSpot Portal Audit that helps you work smarter with HubSpot.