# Server2Server OAuth returning {'code': 200, 'message': 'Account does not enabled REST API.'}

**URL:** <https://devforum.zoom.us/t/server2server-oauth-returning-code-200-message-account-does-not-enabled-rest-api/95519>\
**Category:** Authentication\
**Tags:** api, s2s-oauth\
**Created:** [September 21, 2023, 9:57am UTC](https://devforum.zoom.us/t/server2server-oauth-returning-code-200-message-account-does-not-enabled-rest-api/95519 "2023-09-21T09:57:56Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![ecodes](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ecodes/32/52221_2.png) [@ecodes](https://devforum.zoom.us/u/ecodes)\
**Post date:** [September 22, 2023, 7:39am UTC](https://devforum.zoom.us/t/server2server-oauth-returning-code-200-message-account-does-not-enabled-rest-api/95519/6 "2023-09-22T07:39:00Z")

</div>

Hello i find the solution with PHP and curl, and Server-to-Server OAuth:

I published the code on github

> **[GitHub - CiroArtigot/Zoom-Server-to-Server-OAuth-API: This is a PHP code to...](https://github.com/CiroArtigot/Zoom-Server-to-Server-OAuth-API)**
>
> This is a PHP code to access the Zoom API with a Server-to-Server-OAuth app - GitHub - CiroArtigot/Zoom-Server-to-Server-OAuth-API: This is a PHP code to access the Zoom API with a Server-to-Server...

```auto
$accountID = 'xxxxxxxxxxxx';
$clientId = 'xxxxxxxxxxxxx';
$clientSecret = 'xxxxxxxxxxxxxxx';

$authHeader = base64_encode($clientId . ':' . $clientSecret);
$url = 'https://zoom.us/oauth/token';

$data = [
    'grant_type' => 'account_credentials',
    'account_id' => $accountID,
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Host: zoom.us',
    'Authorization: Basic ' . $authHeader,
]);

$response = curl_exec($ch);

if ($response === false) {
    echo 'Error CURL: ' . curl_error($ch);
} else {
    $responseData = json_decode($response, true);
	$access_token = $responseData['access_token'];
}

curl_close($ch);

if($access_token) {
	$apiCurl = curl_init('https://api.zoom.us/v2/users/me/webinars');
	curl_setopt($apiCurl, CURLOPT_HTTPGET, true);
	curl_setopt($apiCurl, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($apiCurl, CURLOPT_HTTPHEADER, array(
	'Authorization: Bearer ' . $access_token,
	));
	$apiResponse = curl_exec($apiCurl);

	if ($apiResponse === false) echo 'Error: ' . curl_error($apiCurl);
	else echo $apiResponse;
	curl_close($apiCurl);	
}

```

Now this is working for me thanks!

---

_[View the full topic](https://devforum.zoom.us/t/server2server-oauth-returning-code-200-message-account-does-not-enabled-rest-api/95519)._
