Skip to content

Google Sheets Integration API

The Sheets API allows external Google Apps Script to synchronise booking data with an external Google Sheet. These endpoints are authenticated via a shared API key (validated by the validateGsheetKey middleware), not PASETO tokens.

Base Path

/api/sheets

Endpoints

MethodPathDescription
POST/api/sheets/createCreate a booking from a Google Sheet row
PUT/api/sheets/update/:bookingIdUpdate a booking from Sheet
DELETE/api/sheets/delete/:bookingIdDelete a booking from Sheet
PUT/api/sheets/:bookingId/:roomId/status-bookedMark room as booked (from Sheet)
PATCH/api/sheets/invitations/:invitationId/timeoutTimeout an invitation (from Sheet)
POST/api/sheets/:orgId/:bookingId/cancelCancel a booking (from Sheet)
PUT/api/sheets/:orgId/:bookingId/cancelCancel a booking (alternative method)

Authentication

Google Sheets Key

All requests must include a valid API key header:

http
X-GSheet-Key: YOUR_GSHEET_API_KEY

This key is validated by the validateGsheetKey middleware and is separate from user authentication.


Create Booking

http
POST /api/sheets/create
X-GSheet-Key: YOUR_GSHEET_API_KEY
Content-Type: application/json

Request Body

json
{
  "orgId": "org_abc123",
  "guestName": "John Doe",
  "guestEmail": "john@example.com",
  "guestPhone": "+919876543210",
  "checkIn": "2025-08-01",
  "checkOut": "2025-08-05",
  "roomIds": ["room_1", "room_2"],
  "notes": "Late arrival expected"
}

Response — 201 Created

json
{
  "success": true,
  "message": "Booking created from sheet",
  "data": {
    "id": "booking_xyz",
    "bookingCode": "BK-0042"
  }
}

Update Booking

http
PUT /api/sheets/update/:bookingId
X-GSheet-Key: YOUR_GSHEET_API_KEY
Content-Type: application/json

Path Parameters

ParameterTypeDescription
bookingIdstringBooking document ID

Request Body

json
{
  "checkIn": "2025-08-02",
  "checkOut": "2025-08-06",
  "notes": "Updated dates"
}

Response — 200 OK

json
{
  "success": true,
  "message": "Booking updated from sheet"
}

Delete Booking

http
DELETE /api/sheets/delete/:bookingId
X-GSheet-Key: YOUR_GSHEET_API_KEY

Path Parameters

ParameterTypeDescription
bookingIdstringBooking document ID

Response — 200 OK

json
{
  "success": true,
  "message": "Booking deleted from sheet"
}

Mark Room as Booked

http
PUT /api/sheets/:bookingId/:roomId/status-booked
X-GSheet-Key: YOUR_GSHEET_API_KEY

Path Parameters

ParameterTypeDescription
bookingIdstringBooking document ID
roomIdstringRoom document ID

Response — 200 OK

json
{
  "success": true,
  "message": "Room marked as booked"
}

Timeout Invitation

http
PATCH /api/sheets/invitations/:invitationId/timeout
X-GSheet-Key: YOUR_GSHEET_API_KEY

Path Parameters

ParameterTypeDescription
invitationIdstringInvitation document ID

Response — 200 OK

json
{
  "success": true,
  "message": "Invitation timed out"
}

Cancel Booking

http
POST /api/sheets/:orgId/:bookingId/cancel
X-GSheet-Key: YOUR_GSHEET_API_KEY

Path Parameters

ParameterTypeDescription
orgIdstringOrganization ID
bookingIdstringBooking document ID

Response — 200 OK

json
{
  "success": true,
  "message": "Booking cancelled from sheet"
}

Error Responses

All endpoints return the same error format:

json
{
  "success": false,
  "message": "Error description"
}
CodeDescription
400Bad request / missing required fields
401Invalid or missing GSheet API key
404Booking or resource not found
500Internal server error

Released under the MIT License.