Core API Reference

JSON-RPC & API Reference

API endpoints, WebSocket messages, and URL routing parameters that power the Revit AI Suite.

The Revit AI Suite uses a hybrid REST and WebSocket protocol to manage user interface layouts, exchange RPC calls, and trigger dynamic hot-swapping inside Autodesk Revit.


1. URL Query Parameters

You can customize the frontend dashboard view or control the panel loaded inside Autodesk Revit using query parameters:

Parameter Type Mode Description Example
embed Boolean Both Set to true to hide the outer editor dashboard and display only the live canvas. /revitai/?embed=true
layout / template String Both Specifies which layout name should be loaded by default. /revitai/?layout=sheetRenamer
layouts / ids Comma-separated Dashboard Restricts the list of presets shown in the tab selector. /revitai/?layouts=wallCreator,sheetRenamer

2. REST API Endpoints

The backend services expose standard REST endpoints for managing UI templates:

Layouts API

  • GET /api/layouts
    • Description: Retrieves a list of available layout metadata (excluding the heavy JSX code).
    • Query Parameter: ?layouts=wallCreator,sheetRenamer (optional list filter).
  • GET /api/layouts/{layout_name}
    • Description: Retrieves the full layout template including the raw jsx_code string.
  • POST /api/layouts
    • Description: Saves or updates a UI layout template in the database.

Active App Settings

  • GET /api/settings/active-layout
    • Description: Retrieves the currently active layout name.
    • Response:
      { "layout_name": "wallCreator" }
      
  • GET /api/settings/active-layout/set
    • Description: Sets the global active UI layout name and broadcasts a hot-reload event to all active clients.
    • Query Parameter: ?id=sheetRenamer
    • Response:
      {
        "status": "ok",
        "active_layout_name": "sheetRenamer",
        "notified_clients": 1
      }
      

3. Real-Time WebSocket Channel (/revit)

The frontend and Revit add-in establish a persistent WebSocket connection to /revit (e.g., ws://localhost:8000/revit). This channel is used for instantaneous synchronization:

Hot-Swapping Flow

  1. Frontend/Plugin Connect: The client connects to ws://localhost:8000/revit.
  2. State Change: An API request is sent to /api/settings/active-layout/set?id=sheetRenamer.
  3. Broadcast: The backend sends a real-time event to all connected clients:
    {
      "type": "layout_changed",
      "layout_name": "sheetRenamer"
    }
    
  4. Reload: The frontend client receives this event, fetches the new layout code from /api/layouts/sheetRenamer, and redraws the Revit panel UI on screen immediately.