# {"code":124,"message":"Invalid access token."} when calling api to create user from php

**URL:** <https://devforum.zoom.us/t/code-124-message-invalid-access-token-when-calling-api-to-create-user-from-php/6791>\
**Category:** API and Webhooks\
**Created:** [November 23, 2019, 4:17pm UTC](https://devforum.zoom.us/t/code-124-message-invalid-access-token-when-calling-api-to-create-user-from-php/6791 "2019-11-23T16:17:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![defconalert11](https://avatars.discourse-cdn.com/v4/letter/d/96bed5/32.png) [@defconalert11](https://devforum.zoom.us/u/defconalert11)\
**Post date:** [November 23, 2019, 4:17pm UTC](https://devforum.zoom.us/t/code-124-message-invalid-access-token-when-calling-api-to-create-user-from-php/6791/1 "2019-11-23T16:17:49Z")

</div>

**Description/Error**  
@tommy when i try to create user using php i get this error.here is my request function

```php
 	/*Function to send HTTP POST Requests*/
	/*Used by every function below to make HTTP POST call*/
function CallAPI( $url, $data )
{

          $data['api_key'] ='My api key';
		$data['api_secret'] = 'my api secret ';
		$data['data_type'] = 'JSON';
				$postFields = http_build_query($data);

		$ch = curl_init();
		curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
		$response = curl_exec($ch);

		
     

    curl_close($ch);
echo $response;
    return $response;

}
$arrayName = array('action' =>"create" ,'email'=>'zozozozozozozoz@gmail.com','type' =>"1");
   CallAPI("https://api.zoom.us/v2/users",$arrayName);
  ?>

```

---

<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:** [November 25, 2019, 5:25pm UTC](https://devforum.zoom.us/t/code-124-message-invalid-access-token-when-calling-api-to-create-user-from-php/6791/2 "2019-11-25T17:25:39Z")

</div>

Hey @defconalert11,

Are you using an [OAuth App access\_token](https://marketplace.zoom.us/docs/guides/getting-started/app-types/create-oauth-app) or [JWT App JWT Token](https://marketplace.zoom.us/docs/guides/getting-started/app-types/create-jwt-app) as your authentication for the Create User endpoint?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![jgh00003](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jgh00003/32/4219_2.png) [@jgh00003](https://devforum.zoom.us/u/jgh00003)\
**Post date:** [March 26, 2020, 8:53am UTC](https://devforum.zoom.us/t/code-124-message-invalid-access-token-when-calling-api-to-create-user-from-php/6791/3 "2020-03-26T08:53:00Z")

</div>

Hi,  
It gives me the same error when executing this

```
    $curl = curl_init();
    curl_setopt_array($curl, array(
        CURLOPT_URL => "https://api.zoom.us/v2/accounts/{userid}/plans?access_token={access_token}",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "GET",
        CURLOPT_HTTPHEADER => array(
            "authorization: Bearer JWT",
            "content-type: application/json"
        ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);

```

Thanks

---

<div class="post-metadata">

**Author:** ![michael\_p.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_p.zoom/32/18105_2.png) [@michael\_p.zoom](https://devforum.zoom.us/u/michael_p.zoom)\
**Post date:** [March 26, 2020, 7:01pm UTC](https://devforum.zoom.us/t/code-124-message-invalid-access-token-when-calling-api-to-create-user-from-php/6791/4 "2020-03-26T19:01:27Z")

</div>

Hi @jgh00003,

Just verifying, the account that you’re using, is it a master account? Otherwise, you’ll get that error. You could try the same with the different endpoint such as list users - [https://marketplace.zoom.us/docs/api-reference/zoom-api/users/users](https://marketplace.zoom.us/docs/api-reference/zoom-api/users/users).

Thanks

---

<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, 7:25pm UTC](https://devforum.zoom.us/t/code-124-message-invalid-access-token-when-calling-api-to-create-user-from-php/6791/5 "2020-08-21T19:25:06Z")

</div>


