Skip to main content

Table Reservations

Table reservations are for restaurants and dining. They require a floor plan with sections and tables, then follow a query-then-book flow.

Create a floor plan (TypeScript)

Floor plans are demonstrated in the TypeScript SDK guide.

import { WiilClient } from 'wiil-js';
import { CanvasUnit, TableShape } from 'wiil-core-js';

const client = new WiilClient({ apiKey: process.env.WIIL_API_KEY! });

const floorPlan = await client.floorPlans.createDefinition({
name: 'Main Dining Room',
description: 'Primary dining area with 10 tables',
capacity: 40,
canvasDimensions: { width: 800, height: 600, unit: CanvasUnit.PX },
isActive: true,
sections: [
{
name: 'Window Section',
capacity: 16,
color: '#4A90D9',
isActive: true,
sortOrder: 1,
tables: [
{ number: 'W1', x: 100, y: 100, width: 80, height: 80, shape: TableShape.ROUND, minParty: 2, maxParty: 4, combinableWith: [] },
{ number: 'W2', x: 250, y: 100, width: 120, height: 80, shape: TableShape.RECT, minParty: 4, maxParty: 6, combinableWith: [] },
],
},
],
});

Query available slots (TypeScript)

import { ResourceType, ReservationCandidateSlot } from 'wiil-core-js';

const slotResponse = await client.tableReservations.getAvailableSlots({
resourceType: ResourceType.TABLE,
localDate: '2026-06-22',
partySize: 4,
floorPlanId: floorPlan.id,
maxResults: 10,
});

Create a reservation

In TypeScript, table reservations use the tableReservations resource. In Python, the unified reservations resource is used with reservation_type="table".

import { CreateTableReservationSchema } from 'wiil-core-js';

const slot = slotResponse.slots.find(s => s.isAvailable);
if (!slot) throw new Error('No available slots');

// Use slot time directly - API expects UTC seconds
const reservation = await client.tableReservations.create({
resourceId: floorPlan.id,
customerId: 'cust_123',
floorPlanId: floorPlan.id,
time: slot.startTimeUtcSec,
duration: 120,
personsNumber: 4,
isVip: false,
notes: 'Anniversary dinner - window table preferred',
});

TableReservation fields

FieldTypeRequiredDescription
resourceIdstringYesRequested table resource
customerIdstringYesCustomer identifier
floorPlanIdstring | nullNoPreferred or selected floor plan
personsNumberintegerYesParty size
timenumberYesReservation start (Unix timestamp)
durationintegerYesExpected duration in minutes
statusenumYespending, confirmed, seated, checked_in, completed, cancelled, no_show
isVipbooleanYesVIP handling flag (default: false)

Read, update, cancel, delete (TypeScript)

import { UpdateTableReservationSchema } from 'wiil-core-js';

const loaded = await client.tableReservations.get('reservation_123');
const all = await client.tableReservations.list();

const updated = await client.tableReservations.update(reservation.id, {
id: reservation.id,
personsNumber: 6,
notes: 'Updated: Party size increased to 6',
});

const cancelled = await client.tableReservations.cancel(reservation.id, 'Customer requested cancellation');

await client.tableReservations.delete('reservation_123');

In Python, reads and lifecycle use the unified client.reservations resource — see Room Reservations.

Time units

In TypeScript, getAvailableSlots returns UTC seconds (startTimeUtcSec). Pass it directly to time.