Create meeting via API returning error 400

Hello,

I am trying to create a meeting through API. Yesterday the code worked just fine, but today I get error “Request Body should be a valid JSON object.” I have both master and admin scopes, and oauth2 credentials. Here is my code. Can you look into it, please? Tried converting meeting_data ro JSON, and it still returned an error 400 about an invalid JSON, even though python converted to JSON just fine and printed it out to terminal.

logger.info("-----Creating meeting-----")
headers = {"Authorization": f"Bearer {account['access_token']}", "Content-Type": "application/json"}
logger.debug(headers)
        
url = f"{ZOOM_API_BASE}/users/{account['email']}/meetings"
logger.debug(url)
        
try:
    response = requests.post(url, json=meeting_data, headers=headers)
    logger.debug(f"Response status code: {response.status_code}")

    if response.status_code == 201:
        logger.debug(response.json())
        return response.json()
    else:
        logger.error(f"Error when creating a meeting: {response.status_code} - {response.text}")
        return None
except requests.exceptions.RequestException as e:
    logger.error(f"Request failed: {e}")
    return None

The error message says that the Request Body contains invalid data. My guess is that there’s a missing comma, missing curly bracket, the data is malformed or something along these lines. If you want us to investigate further, you should share the data in this post.

Jericho, thank you for pointing that out. Here is a sample JSON from logs:

{
    "topic": "Test",
    "start_time": "2025-03-11T11:00:00Z",
    "duration": 30,
    "type": 2,
    "settings": {
        "participant_video": true,
        "waiting_room": false,
        "auto_recording": "cloud",
        "meeting_authentication": false,
        "end_meeting_when_no_participant": true,
        "join_before_host": true,
        "mute_upon_entry": true,
        "screen_sharing": true,
        "participant_screen_share": true
    }
}

Already checked with JSONPathFinder and json.dumps() - found no errors, maybe you’ll have some ideas. Appreciate any help you can offer.

Hi @Investudy; the parameter end_meeting_when_no_participant does not exist, to my knowledge.

I am able to reproduce the error when I use the data you just shared and I confirm that it’s well-formed, no missing commas, brackets, etc. This leads me to think that the problem is not with the format of your JSON but rather with the actual content.

I started removing the settings nodes one by one: I removed participant_video same result, I removed waiting_room same result, and so on until I removed screen_sharing and my call was successful.

I double checked the documentation for creating a new meeting (here), more specifically the “meeting settings” and I don’t see an entry for screen_sharing. This leads me to conclude that the Zoom API is rejecting your JSON because it contains an unknown node. I must admit that it would have been helpful if the error message was more to the point.

Thank you for your time. I did as you told. Removed all extra data and added “host_video”. My JSON now is as follows:

{
    "topic": "Test",
    "start_time": "2025-03-11T11:00:00Z",
    "duration": 30,
    "type": 2,
    "settings": {
        "host_video": false,
        "participant_video": true,
        "waiting_room": false,
        "auto_recording": "cloud",
        "meeting_authentication": false,
        "join_before_host": true,
        "mute_upon_entry": true
    }
}

Double checked all parameters with the documentation, everything should be valid, but I still get error:

Error when creating a meeting: 400 - <?xml version="1.0" encoding="UTF-8" standalone="yes"?>300Request Body should be a valid JSON object.

Yes, a more specific error message would be helpful. If developers at Zoom could add it in the future releases, I’m sure I wouldn’t be the only one thankful :smiling_face:

I am able to create a meeting with the JSON data you just shared. As you can see below the HTTP POST with your JSON results in a HTTP 201 response.

If you continue to get an error, there must be something else in your code.