POST /api/booking
Creates a new virtual class booking for an authenticated user. The booking is initially created with apending status and is later updated to scheduled when the Google Calendar event is confirmed via webhook.
Authentication
This endpoint requires authentication. The user must be logged in with a valid session.Request Body
ISO 8601 datetime string for the class start timeExample:
"2026-03-15T10:00:00Z"ISO 8601 datetime string for the class end timeExample:
"2026-03-15T11:00:00Z"Whether this is a group class or individual class
true: Group class (grupal)false: Individual class (individual)
Maximum number of students for the classFor individual classes, this is typically 1. For group classes, specify the maximum capacity.
Learning focus or objectives for the classExample:
"Focus on conversational English and pronunciation"Price for the class in cents or smallest currency unitExample:
5000 (represents $50.00)Mercado Pago payment preference IDThis ID links the booking to a payment record and must be unique.
Response
Indicates whether the booking was created successfully
HTTP status code
200: Booking created successfully400: Missing or invalid request data401: User not authenticated500: Server error during booking creation
Example Request
Example Response
Error Responses
Database Record
When a booking is created, a newVirtualClass record is inserted with the following fields:
bookedById: Authenticated user’s IDstartTime: Converted to Date object fromstartendTime: Converted to Date object fromendclassType: “grupal” or “individual” based onisGroupClassclassPrice: Numeric price valuemaxParticipants: FromstudentsCountpreferenceId: Payment preference IDlearningFocus: FromtextparameterparticipantsIds: Array initialized with the creator’s user IDstatus: Initially set topending
Notes
- The booking is created with a
pendingstatus initially - After successful payment confirmation and Google Calendar event creation, the booking status is updated to
scheduledvia a webhook - The user who creates the booking is automatically added as the first participant
- The
preferenceIdmust match a valid Mercado Pago payment preference