# Code=300; message=Api key and secret are required - Powershell

**URL:** <https://devforum.zoom.us/t/code-300-message-api-key-and-secret-are-required-powershell/4603>\
**Category:** API and Webhooks\
**Created:** [June 12, 2019, 6:38am UTC](https://devforum.zoom.us/t/code-300-message-api-key-and-secret-are-required-powershell/4603 "2019-06-12T06:38:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ora](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ora/32/1068_2.png) [@ora](https://devforum.zoom.us/u/ora)\
**Post date:** [June 12, 2019, 6:38am UTC](https://devforum.zoom.us/t/code-300-message-api-key-and-secret-are-required-powershell/4603/1 "2019-06-12T06:38:55Z")

</div>

## Hi Zoom community! So recently I’m writing scripts running from our windows server, and one of our scripts purpose is to delete ex-employees accounts. When I get to the point where I’m trying to connect our Zoom Admin console using Rest API, I keep getting the same error: error

@{code=300; message=Api key and secret are required.}

And I’m 100% sure that my creds are written correctly without any mistakes because it works properly while using the same credentials on Bash.  
In addition, I have tried all encoding methods (UTF8 , ASCII, Default…), I don’t think it is something related to the encoding method…  
Here are the parameters I tested the connection with:  
#==========================  
$clientid = “xxx”  
$key = “xxx”  
$url = “[https://api.zoom.us/v1/metrics/zoomrooms](https://api.zoom.us/v1/metrics/zoomrooms)”  
EncodedUsernamePassword = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes((’{0}:{1}’ -f $clientid, $key)))  
Headers = @{'Authorization' = "Basic ($EncodedUsernamePassword)"; ‘accept’ = ‘application/json’; ‘Content-type’ = ‘application/json’; ‘Accept-Encoding’ = ‘gzip, deflate’}

```
Invoke-RestMethod -Method Get -Uri $url -Headers $Headers
#==========================

```

Assist is very needed here!  
Thanks ahead! 🙂

---

<div class="post-metadata">

**Author:** ![ojus.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ojus.zoom/32/734_2.png) [@ojus.zoom](https://devforum.zoom.us/u/ojus.zoom)\
**Post date:** [June 12, 2019, 11:49pm UTC](https://devforum.zoom.us/t/code-300-message-api-key-and-secret-are-required-powershell/4603/2 "2019-06-12T23:49:15Z")

</div>

Hi @ora,

We are no longer supporting our V1 Apis. Please use our V2 APIs.

You can consider using the [Delete user api](https://marketplace.zoom.us/docs/api-reference/zoom-api/users/userdelete) to perform the operation.

Thanks!

---

<div class="post-metadata">

**Author:** ![ora](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ora/32/1068_2.png) [@ora](https://devforum.zoom.us/u/ora)\
**Post date:** [June 13, 2019, 6:32am UTC](https://devforum.zoom.us/t/code-300-message-api-key-and-secret-are-required-powershell/4603/3 "2019-06-13T06:32:46Z")

</div>

Edit:  
I managed to work this out! Apparently the token I have generated was expired or something…thanks for your help, now I have another little question 🙂  
I’m able to list users from a specific page, is there a way to list all our Zoom users? (and not by counting and using Foreach to display each page content)  
Thanks again!

---

<div class="post-metadata">

**Author:** ![ojus.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ojus.zoom/32/734_2.png) [@ojus.zoom](https://devforum.zoom.us/u/ojus.zoom)\
**Post date:** [June 13, 2019, 9:49pm UTC](https://devforum.zoom.us/t/code-300-message-api-key-and-secret-are-required-powershell/4603/4 "2019-06-13T21:49:35Z")

</div>

Hi @ora,

Please use the [List Users API](https://marketplace.zoom.us/docs/api-reference/zoom-api/users/users) .

Thanks

---

<div class="post-metadata">

**Author:** ![ora](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ora/32/1068_2.png) [@ora](https://devforum.zoom.us/u/ora)\
**Post date:** [June 16, 2019, 7:31am UTC](https://devforum.zoom.us/t/code-300-message-api-key-and-secret-are-required-powershell/4603/5 "2019-06-16T07:31:39Z")

</div>

I managed to fix this issue,  
I had to use Bearer authentication instead of basic, and replace the api key&secret with the JWT token.  
Thanks everyone 🙂
