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

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

 	/*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);
  ?>

Hey @defconalert11,

Are you using an OAuth App access_token or JWT App JWT Token as your authentication for the Create User endpoint?

Thanks,
Tommy

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

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.

Thanks