# Invalid API - to implement a webform

**URL:** <https://devforum.zoom.us/t/invalid-api-to-implement-a-webform/36310>\
**Category:** API and Webhooks\
**Tags:** faq\
**Created:** [November 17, 2020, 10:56pm UTC](https://devforum.zoom.us/t/invalid-api-to-implement-a-webform/36310 "2020-11-17T22:56:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pucpsalavirtual418](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/pucpsalavirtual418/32/18925_2.png) [@pucpsalavirtual418](https://devforum.zoom.us/u/pucpsalavirtual418)\
**Post date:** [November 17, 2020, 10:56pm UTC](https://devforum.zoom.us/t/invalid-api-to-implement-a-webform/36310/1 "2020-11-17T22:56:46Z")

</div>

I am trying to implement a webform to add participants to a meeting.  
So, I am first trying to obtain an authorization token by calling [https://zoom.us/oauth/token](https://zoom.us/oauth/token). Then I try to add participants: [https://api.zoom.us/v2/meetings/{$meetingId}/registrants](https://api.zoom.us/v2/meetings/%7B%24meetingId%7D/registrants)  
… but I get {“code”:200,“message”:“Invalid api key or secret.”}.

```
$clientID = " *********************";
$clientSecret = " *********************";
$meetingId = " *********************";

$content = "grant_type=client_credentials&client_id={$clientID}&client_secret={$clientSecret}";
$token_url = "https://zoom.us/oauth/token";

$ch = curl_init($token_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST , "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS , $content);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT , 60);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
$objJSON = json_decode($result,false);
$oauth_access_token = $objJSON->access_token;

 
$token_url = "https://api.zoom.us/v2/meetings/{$meetingId}/registrants";
$content = "{\"email\":\"myemail@mycompany.com\",\"first_name\":\"Mike\",\"last_name\":\"rown\",\"phone\":\"111-444-4444\"}";
$headers = array(
  "Authorization" => "Bearer " . $oauth_access_token,
  "Content-type" => "application/json"
);

$ch = curl_init($token_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST , "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS , $content);
curl_setopt($ch, CURLOPT_HTTPHEADER , $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER , true);
curl_setopt($ch, CURLOPT_TIMEOUT , 60);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT , 60);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION , TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER , false);
$result = curl_exec($ch);

var_dump( json_decode($result,true) );
```

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [November 18, 2020, 9:19pm UTC](https://devforum.zoom.us/t/invalid-api-to-implement-a-webform/36310/2 "2020-11-18T21:19:06Z")

</div>

Hi @pucpsalavirtual418,

Please make sure you’re setting your `grant_type` parameter in your OAuth request to `authorization_code`, _not_ client\_credentials:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/7/1/7133e0ef604b20e88e29f82bae7f5312c2687ea0.png)

client\_credentials is only for our Chatbot apps.

Let me know if this resolves the issue—thanks!  
Will

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [December 19, 2020, 7:19am UTC](https://devforum.zoom.us/t/invalid-api-to-implement-a-webform/36310/3 "2020-12-19T07:19:20Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
