For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create rooms

Add rooms (e.g., meeting rooms, focus rooms) to your workplace layers, linked to specific spaces for usage and booking.

Prerequisites

  • Completed Setup Your Development Environment and Send Your First API Request

  • Node.js v18+ and npm v9+

  • A valid gospace API key in your .env file

  • An existing location_id and layer_id (rooms belong to a layer)

  • One or more space_id values (spaces must already exist before you can assign them to a room)


1) Create the script

Create create-room.ts:

import "dotenv/config";
import GospaceAI from "@gospace-ai/api";

async function main() {
  const gospace = new GospaceAI(process.env.GOSPACE_API_KEY!);

  const res = await gospace.spatial.createRooms({
    rooms: [
      {
        layer_id: "layer_123",          // required: the layer this room belongs to
        name: "Conference Room A",      // required: room name
        spaces: ["space_001", "space_002"], // assign existing space IDs
        // external_id: "conf-a",        // optional
      },
      {
        layer_id: "layer_123",
        name: "Focus Room 1",
        spaces: ["space_003"],          // single space assigned to the room
      }
    ],
  });

  console.log(JSON.stringify(res.data, null, 2));
}

main().catch((err) => {
  console.error("Request failed:", err);
  process.exit(1);
});

2) Run the script

With TypeScript:


3) (Optional) Verify rooms and their spaces

List rooms for your layer and see which spaces are assigned:

Run:

Last updated