Account does not enabled REST API or Invalid access token Erros

I want to use the Zoom Meetings API to fetch the report that returns the details of who have attended a one particular meeting, the meeting is also recurring

I tried creating an OAuth Server to Server Application as jwt will be deprecated on June or July 2023.

I provided the client id and client secret with the grant type of client credentials in my python script that did generate the access token, but when I try calling

the meeting end point to get the report I am facing two issues either I get this error

{

“code”: 200,

“message”: “Account does not enabled REST API.”

}

or when I try to pass the access token as authorization header in Postman I get this error

{

“code”: 124,

“message”: “Invalid access token.”

}

I tried these endpoints

https://api.zoom.us/v2/metrics/meetings/{meeting_ID}/report

but still the same result

The user id and meeting is correct I applied the developer role to the user ID hence able to create the OAuth Server to Server Application but still facing the same issue

The ID in use is licensed and not a free account.

Not sure if this is the case but said that it is needed to enable rest API from the feature setting, but the admin account is not able to find this option anywhere.

Again, I do not want to integrate this with a 3rd party service or anything complex what I need to mainly is to get one recurring meeting report daily.

Posting my script here from GitHub.

Hi @wajeeh.rehman

Thanks for reaching out to the Zoom Developer Forum and welcome to our community!
By taking a look at the code snippet you shared with us, it looks like you are passing the wrong grant_type.

To request an access token using Server to Server OAuth credentials, the grant_type in the request must be “account_credentials” , this could be the reason why your request to retrieve meetings is failing.

Also, here is a post on How to user Server to Server Oauth app with Postman, that also walks you through the settings needed to be able to use this app type:

Let me know if this helps,
Elisa

Hello I have updated my code as below and I still getting the access tokken but despite that I am getting the error

{
“code”: 124,
“message”: “Invalid access token.”
}

My Updated Code;

import requests
import json
import base64

Replace with your Zoom OAuth client ID and secret

client_id = “cl”
client_secret = “cs”
Account_ID = “AI”

Replace with the ID of the meeting you want to get the report for

meeting_id = “meeting iD”

Get access token

data = {
“grant_type”: “account_credentials”,
“account_id”: Account_ID,
}

Request headers

headers = {
“Host”:“zoom.us”,
“Authorization”: “Basic” + base64.b64encode((client_id + “:” + client_secret).encode()).decode()
}

response = requests.post(“https://zoom.us/oauth/token”, data=data,headers=headers)
print(response)
access_token = response.json()
print(access_token)

API endpoint for getting the report of a specific meeting

new_headers = {
“access_token” : access_token}

API endpoint for getting the report of a specific meeting

url = f"https://api.zoom.us/v2/report/users/{Account_ID}/meetings"
url2 = f"https://api.zoom.us/v2/metrics/meetings/{meeting_id_long}"

Send GET request

response2 = requests.get(url2,headers=new_headers)
print(response2)

Print the report

print(json.dumps(response2.json(), indent=4))

Hi @wajeeh.rehman
It looks like when you are calling the report endpoint, you are passing the account _id, have you tried passing the userID or the parameter “me”

if i use this endpoint
url = f"https://api.zoom.us/v2/me/
I am getting a 200 response but no data
even without passing the access token

I am also getting this error
{

"code": 3001,

"message": "Meeting does not exist: Meeting_ID."

}

I verified that the meetings are present I have checked with multiple meetings even those that are ended and those are recurring

Hi @wajeeh.rehman
This is not a valid endpoint “url = f"https://api.zoom.us/v2/me/”

What I meant is calling the endpoint like this:
https://api.zoom.us/v2/report/users/me/meetings

{“code”:1001,“message”:“User does not exist: me.”}

Please ignore the above I think I am finally able to get it to work
WIll post if I get any other issue

1 Like

Okay so for this endpoint
url2 = “https://api.zoom.us/v2/report/users/user_id/meetings”

I am able to get the summary of the meetings that are held against the account

but when I want to get the participant details using this endpoint

“https://api.zoom.us/v2/metrics/meetings/{meeting_id}/participants”

I get

{“code”:3001,“message”:“Meeting does not exist: Meeting_ID.”}

The meeting ID is correct also I would like to add that the meeting in question is recurring

@wajeeh.rehman
Make sure that the meeting is in the past, future meetings can not be used with report endpoints

But even if I tried with a meeting that has ended though I get a 200 response code I am not getting any returned JSON data

Also I checked my roles option and I am not able to find a way to add the scopes for meeting:read and meeting:write but only for Dashboards and reports

@wajeeh.rehman
Have you been able to follow this guide?

Yes I did follow the guide.
I am finally able to make it work

1 Like

Great news!!! @wajeeh.rehman
Feel free to reach out to us in the future if you need anything else :slight_smile:
Best,
Elisa

This topic was automatically closed 368 days after the last reply. New replies are no longer allowed.