# Getting error code 200 Invalid api key or secret when trying to create meeting with api

**URL:** <https://devforum.zoom.us/t/getting-error-code-200-invalid-api-key-or-secret-when-trying-to-create-meeting-with-api/12138>\
**Category:** API and Webhooks\
**Created:** [April 8, 2020, 1:13pm UTC](https://devforum.zoom.us/t/getting-error-code-200-invalid-api-key-or-secret-when-trying-to-create-meeting-with-api/12138 "2020-04-08T13:13:55Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![fow](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@fow](https://devforum.zoom.us/u/fow)\
**Post date:** [April 8, 2020, 1:13pm UTC](https://devforum.zoom.us/t/getting-error-code-200-invalid-api-key-or-secret-when-trying-to-create-meeting-with-api/12138/1 "2020-04-08T13:13:55Z")

</div>

I have created two apps, one is OAuth type and the other is JWT. I am using the following php code to create a meeting.

$zoomData = ‘{  
“topic”: “API Test”,  
“type”: 2,  
“start\_time”: “2020-04-09T12:02:00”,  
“duration”: “60”,  
“timezone”: “Pacific/Auckland”,  
“password”: “1234”,  
“agenda”: “This is a test meeting”,  
“settings”: {  
“host\_video”: true,  
“participant\_video”: true,  
“audio”: “voip”,  
“waiting\_room”: true  
}  
}’;

$clientID=“XXXXXXXXXXXXXXXX”;  
$clientSecret=“XXXXXXXXXXXXX”;  
$content =“grant\_type=client\_credentials&client\_id=$clientID&client\_secret=$clientSecret”;  
$token\_url=“[https://zoom.us/oauth/token](https://zoom.us/oauth/token)”;  
$curl = curl\_init();  
curl\_setopt\_array($curl, array(  
CURLOPT\_URL =\> $token\_url,  
CURLOPT\_SSL\_VERIFYPEER =\> true,  
CURLOPT\_RETURNTRANSFER =\> true,  
CURLOPT\_POST =\> true,  
CURLOPT\_POSTFIELDS =\> $content  
));

$token = curl\_exec($curl);

$zoomData = json\_encode($zoomData);

$curl = curl\_init();

curl\_setopt\_array($curl, array(  
CURLOPT\_URL =\> “[https://api.zoom.us/v2/users/MYACCOUNTID/meetings](https://api.zoom.us/v2/users/MYACCOUNTID/meetings)”,  
CURLOPT\_RETURNTRANSFER =\> true,  
CURLOPT\_ENCODING =\> “”,  
CURLOPT\_MAXREDIRS =\> 10,  
CURLOPT\_TIMEOUT =\> 30,  
CURLOPT\_HTTP\_VERSION =\> CURL\_HTTP\_VERSION\_1\_1,  
CURLOPT\_CUSTOMREQUEST =\> “POST”,  
CURLOPT\_POSTFIELDS =\> $zoomData,  
CURLOPT\_HTTPHEADER =\> array(“Content-Type: application/json”, "Authorization: Bearer " . json\_decode($token)),  
));

$response = curl\_exec($curl);  
$err = curl\_error($curl);

curl\_close($curl);

if ($err) {  
echo “cURL Error #:” . $err;  
} else {  
echo $response;  
}

I would much prefer to use the JWT app because it seems simpler but I can’t figure out how to code it because I have found no examples anywhere. We want to be able to automatically create zoom meetings via our Wordpress site when someone orders a product.

Any help would be appreciated. Maybe it is something basic I am missing.

Carl

---

<div class="post-metadata">

**Author:** ![techies23](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/techies23/32/406_2.png) [@techies23](https://devforum.zoom.us/u/techies23)\
**Post date:** [April 8, 2020, 1:30pm UTC](https://devforum.zoom.us/t/getting-error-code-200-invalid-api-key-or-secret-when-trying-to-create-meeting-with-api/12138/2 "2020-04-08T13:30:47Z")

</div>

Hi @fow

At the moment when making API calls via JWT token ( new generated ) is having issues. Check the top header “[Developer impacting changes during COVID-19](https://devforum.zoom.us/t/developer-impacting-changes-during-covid-19/8930)” - JWT Token invalid error ( **To fix, deactivate and activate your JWT App** )

For WordPress site - You can try using this [https://wordpress.org/plugins/video-conferencing-with-zoom-api/](https://wordpress.org/plugins/video-conferencing-with-zoom-api/)

Thanks

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [April 8, 2020, 8:30pm UTC](https://devforum.zoom.us/t/getting-error-code-200-invalid-api-key-or-secret-when-trying-to-create-meeting-with-api/12138/3 "2020-04-08T20:30:04Z")

</div>

Hey @fow,

You can also try the PHP sample code / libraries for generating a JWT Token here: [https://jwt.io/](https://jwt.io/)

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![fow](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@fow](https://devforum.zoom.us/u/fow)\
**Post date:** [April 9, 2020, 9:42am UTC](https://devforum.zoom.us/t/getting-error-code-200-invalid-api-key-or-secret-when-trying-to-create-meeting-with-api/12138/4 "2020-04-09T09:42:13Z")

</div>

thank you - looked at the wordpress app and it may be what i have to resort to but i want the flexibility of using my own code and using where needed.

Right now i can’t understand why my oauth app setup works fine on testing [https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingcreate](https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingcreate)

but will not work from our site - {“code”:200,“message”:“Invalid api key or secret.”} keeps getting returned. Why do i need api key or secret when i have used oauth??? It is not needed on the zoom testing page.

---

<div class="post-metadata">

**Author:** ![fow](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@fow](https://devforum.zoom.us/u/fow)\
**Post date:** [April 9, 2020, 9:46am UTC](https://devforum.zoom.us/t/getting-error-code-200-invalid-api-key-or-secret-when-trying-to-create-meeting-with-api/12138/5 "2020-04-09T09:46:26Z")

</div>

thank you for the link. Still trying to push through and make oauth work as i have successfully used it with wordpress and magento 2. Something is not working with this zoom api though. my code is exactly what the zoom testing page uses… i get success with the test but not on our website.

Do i need to put an api key and secret into the code somewhere?

---

<div class="post-metadata">

**Author:** ![fow](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@fow](https://devforum.zoom.us/u/fow)\
**Post date:** [April 9, 2020, 10:45am UTC](https://devforum.zoom.us/t/getting-error-code-200-invalid-api-key-or-secret-when-trying-to-create-meeting-with-api/12138/6 "2020-04-09T10:45:17Z")

</div>

Gave up using the OAuth generated token and simply used a JWT token generated by the app and pasted that into the code. It now works.  
I have been to [https://jwt.io/](https://jwt.io/) to look at how to programmatically create a token. Looks complicated.

Is it safe to use the token generated by the app for a long time? i.e. make the expiry date last for 1 year?

Edit (found the answer that this is NOT ok): “Within the App Credentials page of your JWT app, you will see an option to View JWT Token. Here you can quickly generate a temporary token using the current API Key and Secret for the given expiration time. This single temporary token can then be used to test Zoom APIs, but should never be used in production applications.”

---

<div class="post-metadata">

**Author:** ![StudioBuddy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/studiobuddy/32/4974_2.png) [@StudioBuddy](https://devforum.zoom.us/u/StudioBuddy)\
**Post date:** [April 10, 2020, 3:55am UTC](https://devforum.zoom.us/t/getting-error-code-200-invalid-api-key-or-secret-when-trying-to-create-meeting-with-api/12138/7 "2020-04-10T03:55:24Z")

</div>

Having same issues here with OAuth. Have a feeling given all the recent changes something else backend wise is happening, as code I had failing last week for getting an Access Token is now working today.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [April 10, 2020, 8:40pm UTC](https://devforum.zoom.us/t/getting-error-code-200-invalid-api-key-or-secret-when-trying-to-create-meeting-with-api/12138/8 "2020-04-10T20:40:33Z")

</div>

Hey @fow,

Make sure you are [setting the API Key and Secret as the Basic auth header when doing the OAuth flow.](https://marketplace.zoom.us/docs/guides/auth/oauth#step-2-request-access-token)

> [@fow](#):
>
> Gave up using the OAuth generated token and simply used a JWT token generated by the app and pasted that into the code. It now works.  
> I have been to [https://jwt.io/](https://jwt.io/) to look at how to programmatically create a token. Looks complicated.
> 
> Is it safe to use the token generated by the app for a long time? i.e. make the expiry date last for 1 year?
> 
> Edit (found the answer that this is NOT ok): “Within the App Credentials page of your JWT app, you will see an option to View JWT Token. Here you can quickly generate a temporary token using the current API Key and Secret for the given expiration time. This single temporary token can then be used to test Zoom APIs, but should never be used in production applications.”

Yes, when using [JWT Tokens](https://marketplace.zoom.us/docs/guides/auth/jwt#generating-jwts), it is best to generate the token each time you make a request.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [April 10, 2020, 8:41pm UTC](https://devforum.zoom.us/t/getting-error-code-200-invalid-api-key-or-secret-when-trying-to-create-meeting-with-api/12138/9 "2020-04-10T20:41:31Z")

</div>

Hey @StudioBuddy,

Happy to hear it is working now. Let us know if you run into any other issues. 🙂

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![fow](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@fow](https://devforum.zoom.us/u/fow)\
**Post date:** [April 11, 2020, 11:20pm UTC](https://devforum.zoom.us/t/getting-error-code-200-invalid-api-key-or-secret-when-trying-to-create-meeting-with-api/12138/10 "2020-04-11T23:20:14Z")

</div>

Thank you for the tip @techies23 regarding the Wordpress plugin. I installed it and took a look at his code to see how JWT was implemented. Uses firebase php-jwt. I now have it all working

Final working code is:

```
<?php

```

use \Firebase\JWT\JWT;

```
$key = XXXXXX;
$secret = XXXXXX;

$token = array(
	"iss" => $key,
	"exp" => time() + 3600 //60 seconds as suggested
);

$jwttoken = JWT::encode( $token, $secret );

$zoomData = array( "topic" => "TEST Meeting", "type" => "2", "start_time" => "2020-04-11T20:00:00", "duration" => "60", "timezone" => "Pacific/Auckland", "password" => "1234", "settings" => array ("waiting_room" => "true","audio" => "voip"));
$zoomData = json_encode($zoomData);

```

$curl = curl\_init();

curl\_setopt\_array($curl, array(  
CURLOPT\_URL =\> “[https://api.zoom.us/v2/users/EMAIL@EXAMPLE.COM/meetings](https://api.zoom.us/v2/users/EMAIL@EXAMPLE.COM/meetings)”,  
CURLOPT\_RETURNTRANSFER =\> true,  
CURLOPT\_ENCODING =\> “”,  
CURLOPT\_MAXREDIRS =\> 10,  
CURLOPT\_TIMEOUT =\> 30,  
CURLOPT\_HTTP\_VERSION =\> CURL\_HTTP\_VERSION\_1\_1,  
CURLOPT\_CUSTOMREQUEST =\> “POST”,  
CURLOPT\_POSTFIELDS =\> $zoomData,  
CURLOPT\_HTTPHEADER =\> array(“Content-Type: application/json”, "Authorization: Bearer " . $jwttoken),  
));

$response = curl\_exec($curl);  
curl\_close($curl);

?\>

---

<div class="post-metadata">

**Author:** ![bdeanindy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bdeanindy/32/154_2.png) [@bdeanindy](https://devforum.zoom.us/u/bdeanindy)\
**Post date:** [April 12, 2020, 3:17am UTC](https://devforum.zoom.us/t/getting-error-code-200-invalid-api-key-or-secret-when-trying-to-create-meeting-with-api/12138/11 "2020-04-12T03:17:46Z")

</div>

Thanks for sharing your solution with us!

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 8:24pm UTC](https://devforum.zoom.us/t/getting-error-code-200-invalid-api-key-or-secret-when-trying-to-create-meeting-with-api/12138/12 "2020-08-21T20:24:19Z")

</div>

Closed on August 21, 2020, 8:24pm UTC


