Getting err: 400 Bad Request when creating a meeting

I am using POST: to create a meeting using go, here’s my code

// Create ...
func (zm *ZoomMeeting) Create(data *model.Talk) (*ZoomMeetingResponse, error) {
	payloads := &ZoomMeetingRequest{
		Agenda:   data.Description,
		Duration: data.Duration,
		Password: "1234qwer",
		Timezone: data.TimeZone,
		Topic:    data.Title,
		Type:     int64(2),
		Settings: &ZoomMeetingSettingsRequest{
			ApprovalType:                 int64(0),
			Audio:                        "both",
			AutoRecording:                "none",
			CnMeeting:                    false,
			HostVideo:                    true,
			InMeeting:                    false,
			JoinBeforeHost:               false,
			MuteUponEntry:                true,
			ParticipantVideo:             true,
			RegistrationType:             int64(2),
			RegistrantsEmailNotification: false,
			UsePmi:                       false,
			Watermark:                    false,
		StartTime: data.DateTimeStart.Format("2006-01-02T03:04:05Z"),

	payloadsByte, err := json.Marshal(payloads)
	if err != nil {
		return nil, err

	request, err := http.NewRequest(
	if err != nil {
		return nil, err
	request.Header.Add("content-type", "application/json")
	request.Header.Add("authorization", fmt.Sprintf("Bearer %s", zm.Provider.GetAccessToken()))

	resp, err := zm.Client.Do(request)
	if err != nil {
		return nil, err

	if resp.StatusCode != 200 {
		a := fmt.Sprintf("Create zoom meeting err: %s", resp.Status)
		return nil, errors.New(a)

	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err

	result := ZoomMeetingResponse{}

	if err := json.Unmarshal(body, &result); err != nil {
		return nil, err

	return &result, nil

Here’s the printed request

   Authorization:[Bearer ...] 
         "agenda":"\u003cp\u003eZoom meeting creation example\u003c/p\u003e\n",
         "topic":"Zoom meeting creation example",

The error from this line

if resp.StatusCode != 200 {
   a := fmt.Sprintf("Create zoom meeting err: %s", resp.Status)
   return nil, errors.New(a)

Reads: [ERROR] Create zoom meeting err: 400 Bad Request

Which App Type (OAuth / Chatbot / JWT / Webhook)?


Which Endpoint/s?

Hey @littlechad,

Typically the 400 Bad Request error is thrown when the request body is invalid.

Can you help explain what the Reader object is? Are you sending the Reader object as apart of the request body? If you could log your request body in JSON format before you make the request, and share it here, we can debug further. :slight_smile:


Hi Tommy,

the Reader thingy is golang io.Reader interface returned from this line bytes.NewBuffer(payloadsByte), since the http.NewRequest() method requires it as the third argument.

Anyway the actual issue turns out to be the zm *ZoomMeeting interface i initiated beforehand, and i actually manage to solve this issue, by rewriting the http.Client for ZoomMeeting.Client

Sorry to bother your holiday, thanks for taking your time to reply to this, Happy new year :slight_smile:

1 Like

Hey @littlechad,

Happy to hear you got it sorted out! :slight_smile:

Thanks for sharing the solution as well!

Happy near year!

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