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".
- TypeScript
- Python
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',
});
from time import time
from wiil.models.business_mgt import CreateReservation, CreateResource
now_ms = int(time() * 1000)
table = client.reservation_resources.create(
CreateResource(
resource_type="table",
name="Table 5",
description="Window-side table for 4 guests",
capacity=4,
is_available=True,
location="Main dining area",
amenities=["Window view", "Booth seating"],
reservation_duration=2,
reservation_duration_unit="hours",
sync_enabled=False,
)
)
reservation = client.reservations.create(
CreateReservation(
reservation_type="table",
resource_id=table.id,
customer_id="cust_123",
start_time=now_ms + 3600000,
end_time=now_ms + 7200000,
duration=2,
persons_number=4,
total_price=0,
deposit_paid=0,
notes="Window table preferred",
is_resource_reservation=True,
)
)
TableReservation fields
| Field | Type | Required | Description |
|---|---|---|---|
resourceId | string | Yes | Requested table resource |
customerId | string | Yes | Customer identifier |
floorPlanId | string | null | No | Preferred or selected floor plan |
personsNumber | integer | Yes | Party size |
time | number | Yes | Reservation start (Unix timestamp) |
duration | integer | Yes | Expected duration in minutes |
status | enum | Yes | pending, confirmed, seated, checked_in, completed, cancelled, no_show |
isVip | boolean | Yes | VIP 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.