# Creating users by Curl post /users giving error "Invalid access token" and code 124

**URL:** <https://devforum.zoom.us/t/creating-users-by-curl-post-users-giving-error-invalid-access-token-and-code-124/75693>\
**Category:** Meetings\
**Created:** [September 9, 2022, 12:56pm UTC](https://devforum.zoom.us/t/creating-users-by-curl-post-users-giving-error-invalid-access-token-and-code-124/75693 "2022-09-09T12:56:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![symapptest3](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/symapptest3/32/39913_2.png) [@symapptest3](https://devforum.zoom.us/u/symapptest3)\
**Post date:** [September 9, 2022, 12:56pm UTC](https://devforum.zoom.us/t/creating-users-by-curl-post-users-giving-error-invalid-access-token-and-code-124/75693/1 "2022-09-09T12:56:06Z")

</div>

API endpoint: post /users  
Hi, I want to create new user for Zoom Meeting API by curl. I have created Client ID and Client Secret and made the header as base64\_encode(CLIENT\_ID.‘:’.CLIENT\_SECRET);

“Invalid access token” and code 124.

$auth = base64\_encode(CLIENT\_ID.‘:’.CLIENT\_SECRET);

$json\_data = ‘[  
“action” =\> “create”,  
“email” =\> “[symapptest10@gmail.com](mailto:symapptest10@gmail.com)”,  
“type” =\> 1,  
]’;

curl\_setopt($ch, CURLOPT\_URL, ‘[https://api.zoom.us/v2/users/](https://api.zoom.us/v2/users/)’);  
curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, 1);  
curl\_setopt($ch, CURLOPT\_POST, 1);  
curl\_setopt($ch, CURLOPT\_POSTFIELDS, $json\_data);

$headers = array();  
$headers = ‘Authorization: Basic ‘.$auth.’’;  
$headers = ‘Content-Type: application/json’;  
curl\_setopt($ch, CURLOPT\_HTTPHEADER, $headers);  
$result = curl\_exec($ch);

Please suggest what is the problem and what may be the solution.

---

<div class="post-metadata">

**Author:** ![ojus.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ojus.zoom/32/734_2.png) [@ojus.zoom](https://devforum.zoom.us/u/ojus.zoom)\
**Post date:** [September 10, 2022, 4:49am UTC](https://devforum.zoom.us/t/creating-users-by-curl-post-users-giving-error-invalid-access-token-and-code-124/75693/2 "2022-09-10T04:49:07Z")

</div>

Hi @symapptest3 ,

The authentication that you are using is Basic, you should be using the “Bearer Token” instead.

Here are the steps to make an API call in Zoom:

1. Generate an Access Token  
Refer: [OAuth with Zoom](https://marketplace.zoom.us/docs/guides/auth/oauth/) or  
[Create a Server-to-Server OAuth app](https://marketplace.zoom.us/docs/guides/build/server-to-server-oauth-app/)

2. Use the access token to make the API call.  
Refer: [OAuth with Zoom](https://marketplace.zoom.us/docs/guides/auth/oauth/#using-an-access-token)

Let me know if this helps
