> ## Documentation Index
> Fetch the complete documentation index at: https://docs.koulis.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Tables API — List, Create, Update, and Delete Tables

> Full CRUD for restaurant tables via /api/v1/restaurant/me/tables — list, create, update, delete, and bulk-update positions. Requires JWT authentication.

The tables endpoints give you programmatic control over your restaurant's table inventory. You can list all tables, create new ones, update existing ones, delete them, and bulk-update their positions on the floor plan. All requests require a valid JWT Bearer token.

***

## List tables

Returns all tables for your restaurant.

### Endpoint

```
GET https://api.lakreme.fr/api/v1/restaurant/me/tables
```

<RequestExample>
  ```bash cURL theme={null}
  curl https://api.lakreme.fr/api/v1/restaurant/me/tables \
    -H "Authorization: Bearer YOUR_JWT_TOKEN"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  [
    {
      "id": "tbl_001",
      "name": "Table 1",
      "seats": 4,
      "is_active": true,
      "display_order": 1,
      "room_id": "room_main",
      "pos_x": 100,
      "pos_y": 80,
      "width": 80,
      "height": 80,
      "shape": "rect",
      "rotation": 0
    },
    {
      "id": "tbl_002",
      "name": "Bar 2",
      "seats": 2,
      "is_active": true,
      "display_order": 2,
      "room_id": "room_main",
      "pos_x": 220,
      "pos_y": 80,
      "width": 60,
      "height": 60,
      "shape": "circle",
      "rotation": 0
    }
  ]
  ```
</ResponseExample>

***

## Create a table

Creates a new table. `name` and `seats` are required; all other fields are optional and default to sensible values.

### Endpoint

```
POST https://api.lakreme.fr/api/v1/restaurant/me/tables
```

### Request body

<ParamField body="name" type="string" required>
  Display name of the table — for example, `"Table 5"` or `"Terrace 1"`.
</ParamField>

<ParamField body="seats" type="number" required>
  Number of seats at this table. Must be greater than zero.
</ParamField>

<ParamField body="display_order" type="number">
  Ordering position in list views. Lower values appear first.
</ParamField>

<ParamField body="room_id" type="string">
  The ID of the room this table belongs to. If your restaurant has only one room, you can omit this field.
</ParamField>

<ParamField body="pos_x" type="number">
  Horizontal position on the floor plan canvas, in pixels.
</ParamField>

<ParamField body="pos_y" type="number">
  Vertical position on the floor plan canvas, in pixels.
</ParamField>

<ParamField body="width" type="number">
  Width of the table shape on the canvas, in pixels.
</ParamField>

<ParamField body="height" type="number">
  Height of the table shape on the canvas, in pixels.
</ParamField>

<ParamField body="shape" type="string">
  Shape of the table on the floor plan. Accepted values: `"rect"` (rectangle) or `"circle"`.
</ParamField>

<ParamField body="rotation" type="number">
  Rotation angle of the table in degrees. For example, `45` rotates the table 45 degrees clockwise.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.lakreme.fr/api/v1/restaurant/me/tables \
    -H "Authorization: Bearer YOUR_JWT_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Terrace 3",
      "seats": 6,
      "shape": "rect",
      "pos_x": 340,
      "pos_y": 200,
      "width": 100,
      "height": 60,
      "room_id": "room_terrace"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "id": "tbl_003",
    "name": "Terrace 3",
    "seats": 6,
    "is_active": true,
    "display_order": 3,
    "room_id": "room_terrace",
    "pos_x": 340,
    "pos_y": 200,
    "width": 100,
    "height": 60,
    "shape": "rect",
    "rotation": 0
  }
  ```
</ResponseExample>

***

## Update a table

Updates one or more fields on an existing table. Only include the fields you want to change.

### Endpoint

```
PATCH https://api.lakreme.fr/api/v1/restaurant/me/tables/{id}
```

<ParamField path="id" type="string" required>
  The ID of the table to update.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH https://api.lakreme.fr/api/v1/restaurant/me/tables/tbl_003 \
    -H "Authorization: Bearer YOUR_JWT_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "seats": 8,
      "name": "Terrace 3 (large)"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "tbl_003",
    "name": "Terrace 3 (large)",
    "seats": 8,
    "is_active": true,
    "display_order": 3,
    "room_id": "room_terrace",
    "pos_x": 340,
    "pos_y": 200,
    "width": 100,
    "height": 60,
    "shape": "rect",
    "rotation": 0
  }
  ```
</ResponseExample>

***

## Delete a table

Permanently deletes a table. Returns `204 No Content` on success.

### Endpoint

```
DELETE https://api.lakreme.fr/api/v1/restaurant/me/tables/{id}
```

<ParamField path="id" type="string" required>
  The ID of the table to delete.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE https://api.lakreme.fr/api/v1/restaurant/me/tables/tbl_003 \
    -H "Authorization: Bearer YOUR_JWT_TOKEN"
  ```
</RequestExample>

<ResponseExample>
  ```json 204 theme={null}
  ```
</ResponseExample>

***

## Bulk update table positions

Updates the floor plan positions of multiple tables in a single request. Useful after a drag-and-drop repositioning session in a floor plan editor.

### Endpoint

```
POST https://api.lakreme.fr/api/v1/restaurant/me/tables/bulk-positions
```

### Request body

<ParamField body="updates" type="object[]" required>
  Array of position update objects. Each object identifies a table by `id` and provides its new position.

  <Expandable title="update properties">
    <ParamField body="id" type="string" required>
      The ID of the table to reposition.
    </ParamField>

    <ParamField body="pos_x" type="number" required>
      New horizontal position on the canvas, in pixels.
    </ParamField>

    <ParamField body="pos_y" type="number" required>
      New vertical position on the canvas, in pixels.
    </ParamField>

    <ParamField body="room_id" type="string">
      New room assignment. Provide this if you are moving a table between rooms.
    </ParamField>

    <ParamField body="rotation" type="number">
      New rotation angle in degrees.
    </ParamField>
  </Expandable>
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.lakreme.fr/api/v1/restaurant/me/tables/bulk-positions \
    -H "Authorization: Bearer YOUR_JWT_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "updates": [
        { "id": "tbl_001", "pos_x": 120, "pos_y": 90 },
        { "id": "tbl_002", "pos_x": 240, "pos_y": 90, "rotation": 45 }
      ]
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "updated": 2
  }
  ```
</ResponseExample>
