Skip to main content
POST
Create Booking

Description

This endpoint allows you to create a new booking in your LatePoint system. It includes automatic availability validation, creation of new customers if necessary, and application of configured business rules.

Authentication

string
required
Your LatePoint API key. You can get it from the admin panel.

Request Body

Required Fields

integer
required
ID of the service to book
integer|string
required
ID of the agent who will provide the service. Use “any” or “-1” for automatic agent assignment based on availability
string
required
Booking date (format: YYYY-MM-DD)
string
required
Start time (format: HH:MM in 24-hour format)

Customer Information

integer
ID of an existing customer. If provided, new customer fields are ignored
string
Customer first name (required if customer_id is not provided)
string
Customer last name (required if customer_id is not provided)
string
Customer email (required if customer_id is not provided)
string
Customer phone

Optional Fields

integer
Location ID (uses default location if not specified)
integer
Custom duration in minutes (uses service default duration)
string
Custom price (uses service default price)
string
default:"pending"
Initial booking statusPossible values:
  • pending - Pending
  • approved - Approved
  • cancelled - Cancelled
string
Additional notes for the booking
boolean
default:"true"
Whether to send confirmation email to customer

Respuesta

Success Response (201 Created)

string
Response status (“success”)
object
Created booking object

Examples

Create Booking with Existing Customer

Create Booking with New Customer

Example Response

Successfully Created Booking

Error Codes

Validations

Automatic Validations

The system performs the following validations automatically:
  1. Agent Availability: Verifies that the agent is available at the requested time
  2. Working Hours: Validates that the time is within the agent’s working hours
  3. Service Duration: Verifies there is enough time to complete the service
  4. Valid Dates: Does not allow bookings on past dates
  5. Unique Email: If creating a new customer, verifies the email is not already in use

Business Rules

Existing vs New Customer: If you provide customer_id, all customer fields are ignored. If you don’t provide customer_id, the first_name, last_name and email fields are required.
Availability Check: Always verify availability using the /availability endpoint before creating a booking to avoid conflicts.
Booking Codes: Booking codes are automatically generated following the pattern LP-YYYY-NNN where YYYY is the year and NNN is a sequential number.

1. Check Availability

2. Create the Booking

3. Handle the Response

Common Use Cases

1. Quick Booking (Existing Customer)

2. First Booking (New Customer)

3. Booking with Custom Configuration