# cannot access the api

**URL:** <https://community.hubspot.com/t/cannot-access-the-api/91350>\
**Category:** Account & Settings\
**Tags:** starter\
**Created:** [October 9, 2023, 12:18am UTC](https://community.hubspot.com/t/cannot-access-the-api/91350 "2023-10-09T00:18:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadi2023](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@Sadi2023](https://community.hubspot.com/u/Sadi2023)\
**Post date:** [October 9, 2023, 12:18am UTC](https://community.hubspot.com/t/cannot-access-the-api/91350/1 "2023-10-09T00:18:06Z")

</div>

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

```lia-code-sample
$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

```lia-code-sample
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

---

<div class="post-metadata">

**Author:** ![Mike\_Eastwood](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mike_eastwood/32/70075_2.png) [@Mike\_Eastwood](https://community.hubspot.com/u/Mike_Eastwood)\
**Post date:** [October 9, 2023, 1:30am UTC](https://community.hubspot.com/t/cannot-access-the-api/91350/2 "2023-10-09T01:30:14Z")

</div>

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](https://developers.hubspot.com/docs/api/settings/user-provisioning).

Have fun

Mike

Here to learn more about HubSpot and share my HubSpot Knowledge. I’m the founder of [Webalite](https://www.webalite.com?utm_campaign=community-forum&utm_source=community&utm_content=signature) a HubSpot Partner Agency based in Wellington, New Zealand and the founder of **Portal-iQ** the world’s first automated [HubSpot Portal Audit](https://portal-iq.com?utm_campaign=community-forum&utm_source=community-forum&utm_content=signature) that helps you work smarter with HubSpot.
