§
SYSTEM: ONLINE
← BACK TO MODULES

Booking Matrix API Documentation

The Booking Matrix API provides relational data endpoints. Bookings are strictly tied to User entities. All operations require a valid userId foreign key reference.

Base URL
http://localhost:3000/api/bookings
GET/api/bookings

Retrieve and filter matrix bookings

Returns all bookings. Supports URL query parameters for filtering: `?firstname=[string]&lastname=[string]`.

Bearer Token Required: `autolab-bearer-token-123`
Expected Response 200 OK
{
  "data": [
    {
      "id": "uuid-string",
      "userId": "uuid-from-users",
      "date": "2024-12-01",
      "status": "Confirmed",
      "notes": "VIP request",
      "createdAt": "2024-01-01T00:00:00.000Z",
      "firstName": "Subject",
      "lastName": "Zero",
      "email": "sub0@autolab.io"
    }
  ]
}
POST/api/bookings

Allocate a new matrix booking

Creates a new booking tied to a specific user. Fails with 400 Bad Request if the `userId` does not exist in the Users database.

Bearer Token Required: `autolab-bearer-token-123`
Request Payload (JSON)
{
  "userId": "string (valid user UUID)",
  "date": "string (YYYY-MM-DD)",
  "status": "string (Pending | Confirmed | Cancelled)",
  "notes": "string (optional)"
}
Expected Response 201 Created
{
  "id": "uuid-generated",
  "userId": "string",
  "date": "string",
  "status": "string",
  "notes": "string"
}
GET/api/bookings/[id]

Retrieve specific booking by ID

Fetch a single booking entity along with its joined User data.

Bearer Token Required: `autolab-bearer-token-123`
Expected Response 200 OK
{
  "data": {
    "id": "uuid",
    "userId": "...",
    "date": "...",
    "status": "...",
    "firstName": "..."
  }
}
PUT/api/bookings/[id]

Modify booking state

Update the date, status, or notes of an existing booking. You cannot change the `userId` after creation.

Bearer Token Required: `autolab-bearer-token-123`
Request Payload (JSON)
{
  "date": "optional",
  "status": "optional text",
  "notes": "optional"
}
Expected Response 200 OK
{
  "id": "uuid",
  "date": "updated",
  "status": "updated",
  "notes": "updated"
}
DELETE/api/bookings/[id]

Purge matrix booking

Hard deletes a booking record from the database.

Bearer Token Required: `autolab-bearer-token-123`
Expected Response 204 No Content
Empty body returned