Skip to content

๐Ÿ“ Locations API โ€‹

๐Ÿ“‹ List Locations โ€‹

GET /api/locations

Public. Returns all active locations.

Response:

json
{
  "success": true,
  "data": [
    {
      "id": "cuid",
      "name": "Downtown Kitchen",
      "slug": "downtown-kitchen",
      "address": "123 Main St",
      "city": "New York",
      "state": "NY",
      "postalCode": "10001",
      "phone": "+1234567890",
      "deliveryEnabled": true,
      "pickupEnabled": true,
      "isActive": true,
      "isBusy": false
    }
  ]
}

๐Ÿ” Get Location โ€‹

GET /api/locations/:id

Public. Returns a single location with full details.

โž• Create Location โ€‹

POST /api/locations
Authorization: Bearer <manager-token>

Request:

json
{
  "name": "Uptown Kitchen",
  "slug": "uptown-kitchen",
  "address": "456 Oak Ave",
  "city": "New York",
  "state": "NY",
  "postalCode": "10002",
  "deliveryEnabled": true,
  "pickupEnabled": true,
  "deliveryLeadTime": 30,
  "pickupLeadTime": 15,
  "minOrderDelivery": 15.00,
  "minOrderPickup": 0
}

โœ๏ธ Update Location โ€‹

PATCH /api/locations/:id
Authorization: Bearer <manager-token>

Partial updates supported โ€” only include fields to change.

๐Ÿ—‘๏ธ Delete Location โ€‹

DELETE /api/locations/:id
Authorization: Bearer <super-admin-token>

๐Ÿšš Delivery Zones โ€‹

๐Ÿ“‹ List Delivery Zones โ€‹

GET /api/locations/:locationId/delivery-zones

๐Ÿ“ Check Delivery Zone โ€‹

GET /api/locations/:locationId/delivery-zones/check?lat=40.7128&lng=-74.0060

Public. Checks if coordinates fall within a delivery zone and returns the applicable delivery fee.

โž• Create Delivery Zone โ€‹

POST /api/locations/:locationId/delivery-zones
Authorization: Bearer <manager-token>
json
{
  "name": "Zone 1 - Downtown",
  "charge": 3.99,
  "minOrder": 15.00,
  "boundaries": { "type": "Polygon", "coordinates": [...] },
  "isActive": true
}

โœ๏ธ๐Ÿ—‘๏ธ Update / Delete Delivery Zone โ€‹

PATCH /api/locations/:locationId/delivery-zones/:zoneId
DELETE /api/locations/:locationId/delivery-zones/:zoneId

๐Ÿช‘ Tables โ€‹

๐Ÿ“‹ List Tables โ€‹

GET /api/locations/:locationId/tables

๐Ÿ” Get Table โ€‹

GET /api/locations/:locationId/tables/:tableId

โž• Create Table โ€‹

POST /api/locations/:locationId/tables
Authorization: Bearer <manager-token>
json
{
  "name": "Table 1",
  "capacity": 4,
  "isActive": true
}

โœ๏ธ๐Ÿ—‘๏ธ Update / Delete Table โ€‹

PATCH /api/locations/:locationId/tables/:tableId
DELETE /api/locations/:locationId/tables/:tableId

๐Ÿ”’ Permissions Summary โ€‹

ActionRequired Role
๐ŸŒ List / get locationsPublic
โœ๏ธ Create / update locationsManager, Super Admin
๐Ÿ—‘๏ธ Delete locationsSuper Admin
๐ŸŒ List / check delivery zonesPublic
โœ๏ธ Manage delivery zonesManager, Super Admin
๐Ÿ—‘๏ธ Delete delivery zonesSuper Admin
๐ŸŒ List / get tablesPublic
โœ๏ธ Manage tablesManager, Super Admin
๐Ÿ—‘๏ธ Delete tablesSuper Admin