# I am not being able to create meeting via api

**URL:** <https://devforum.zoom.us/t/i-am-not-being-able-to-create-meeting-via-api/121895>\
**Category:** Meetings\
**Tags:** api\
**Created:** [December 3, 2024, 9:33pm UTC](https://devforum.zoom.us/t/i-am-not-being-able-to-create-meeting-via-api/121895 "2024-12-03T21:33:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![poshan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/poshan/32/65395_2.png) [@poshan](https://devforum.zoom.us/u/poshan)\
**Post date:** [December 3, 2024, 9:33pm UTC](https://devforum.zoom.us/t/i-am-not-being-able-to-create-meeting-via-api/121895/1 "2024-12-03T21:33:19Z")

</div>

Hi, I am trying to create a meeting, for that I have created a general app. from which I am getting my client id and client secret. for now I am using it to only create sample api so I donot have any redirect URL.

import requests  
import json  
from datetime import datetime  
import time

CLIENT\_ID = ‘_**’  
CLIENT\_SECRET = '**’  
API\_ACCOUNT\_ID = '_\_\_’

def get\_access\_token():  
“”“Get an access token for Zoom API authentication”“”  
try:  
url = “\_\_\_\_”  
data = {  
“grant\_type”: “client\_credentials”  
}  
response = requests.post(url, auth=(CLIENT\_ID, CLIENT\_SECRET), data=data)  
response.raise\_for\_status()  
access\_token = response.json()[“access\_token”]  
print(f"Obtained access token: {access\_token}“)  
return access\_token  
except requests.exceptions.RequestException as e:  
print(f"Error getting access token: {e}”)  
return None

def create\_meeting(user\_id, meeting\_details):  
“”“Create a Zoom meeting”“”  
try:  
url = f""  
access\_token = get\_access\_token()  
if access\_token:  
headers = {  
“Authorization”: f"Bearer {access\_token}“,  
“Content-Type”: “application/json”  
}  
meeting\_details[“start\_time”] = meeting\_details[“start\_time”].strftime(”%Y-%m-%dT%H:%M:%SZ")  
response = requests.post(url, headers=headers, data=json.dumps(meeting\_details))  
response.raise\_for\_status()  
print(f"Meeting created successfully: {response.json()[‘topic’]}“)  
return response.json()  
else:  
return {“error”: “Failed to get access token”}  
except requests.exceptions.RequestException as e:  
print(f"Error creating meeting: {e}”)  
print(f"Response status code: {e.response.status\_code}“)  
print(f"Response content: {e.response.content}”)  
return {“error”: str(e)}

# Example meeting details

meeting\_details = {  
“topic”: “My Meeting”,  
“type”: 2,  
“start\_time”: datetime(2022, 3, 25, 7, 32, 55),  
“duration”: 60,  
“agenda”: “Discuss project updates”,  
“settings”: {  
“host\_video”: True,  
“participant\_video”: False,  
“join\_before\_host”: False,  
“mute\_upon\_entry”: True,  
“waiting\_room”: False  
}  
}

result = create\_meeting(API\_ACCOUNT\_ID, meeting\_details)  
if “error” in result:  
print(f"Error: {result[‘error’]}")  
this is sample code it is generating access token but  
Error creating meeting: 401 Client Error: Unauthorized for url: \_\_\_\_\_\_  
Response status code: 401  
Response content: b’{“code”:124,“message”:“This API does not support client credentials for authorization.”}’  
Error: 401 Client Error: Unauthorized for ur this is thrown. I think my api\_acount\_id might be wrong how do I get that.
