import type { NextApiRequest } from "next"; import handleNewBooking from "@calcom/features/bookings/lib/handleNewBooking"; import { defaultResponder } from "@calcom/lib/server"; /** * @swagger * /bookings: * post: * summary: Creates a new booking * parameters: * - in: query * name: apiKey * required: true * schema: * type: string * description: Your API key * operationId: addBooking * requestBody: * description: Create a new booking related to one of your event-types * required: true * content: * application/json: * schema: * type: object * required: * - startTime * - endTime * properties: * title: * type: string * description: 'Booking event title' * startTime: * type: string * format: date-time * description: 'Start time of the Event' * endTime: * type: string * format: date-time * description: 'End time of the Event' * recurringEventId: * type: integer * description: 'Recurring event ID if the event is recurring' * description: * type: string * description: 'Event description' * status: * type: string * description: 'Acceptable values one of ["ACCEPTED", "PENDING", "CANCELLED", "REJECTED"]' * location: * type: string * description: 'Meeting location' * seatsPerTimeSlot: * type: integer * description: 'The number of seats for each time slot' * seatsShowAttendees: * type: boolean * description: 'Share Attendee information in seats' * smsReminderNumber: * type: number * description: 'SMS reminder number' * attendees: * type: array * description: 'List of attendees of the booking' * items: * type: object * properties: * name: * type: string * email: * type: string * format: email * timeZone: * type: string * locale: * type: string * * tags: * - bookings * responses: * 201: * description: Booking(s) created successfully. * 400: * description: | * Bad request *
Message | *Cause | *
Booking body is invalid | *Missing property on booking entity. | *
Invalid eventTypeId | *The provided eventTypeId does not exist. | *
Missing recurringCount | *The eventType is recurring, and no recurringCount was passed. | *
Invalid recurringCount | *The provided recurringCount is greater than the eventType recurring config | *