Skip to content

Event Types

Event types define the services a provider offers — haircuts, consultations, classes, etc. Each event type configures duration, booking questions, limits, pricing, and behavior.

import { validateEventType, EventTypeValidationError } from "@thebookingkit/core";
validateEventType({
title: "30-Minute Consultation",
slug: "30-min-consultation",
durationMinutes: 30,
priceCents: 5000,
minimumNoticeMinutes: 60,
maxAdvanceDays: 30,
bufferBefore: 0,
bufferAfter: 15,
});
// Throws EventTypeValidationError if invalid
import { generateSlug } from "@thebookingkit/core";
generateSlug("30-Minute Consultation"); // "30-minute-consultation"
generateSlug("Haircut & Beard Trim"); // "haircut-beard-trim"

Event types can define custom questions that customers answer during the booking flow:

import type { BookingQuestion } from "@thebookingkit/core";
const questions: BookingQuestion[] = [
{
id: "reason",
label: "What is the reason for your visit?",
type: "textarea",
required: true,
},
{
id: "first_visit",
label: "Is this your first visit?",
type: "select",
required: true,
options: ["Yes", "No"],
},
{
id: "phone",
label: "Phone number",
type: "phone",
required: false,
},
];
TypeDescription
textSingle-line text input
textareaMulti-line text
selectDropdown with predefined options
multiselectMultiple selection from options
checkboxBoolean toggle
phonePhone number input
numberNumeric input
import { validateQuestionResponses } from "@thebookingkit/core";
const responses = { reason: "Annual checkup", first_visit: "No" };
validateQuestionResponses(questions, responses);
// Throws if required fields are missing or types don't match
FieldTypeDescription
titlestringDisplay name of the event type
slugstringURL-safe identifier
durationMinutesnumberLength of appointment
priceCentsnumberPrice in cents (0 for free)
bufferBeforenumberMinutes of padding before
bufferAfternumberMinutes of padding after
minimumNoticeMinutesnumberMinimum advance booking time
maxAdvanceDaysnumberHow far in advance bookings are allowed
requiresConfirmationbooleanWhether provider must approve
maxBookingsPerDaynumberDaily booking limit
questionsBookingQuestion[]Custom booking questions (JSONB)