Jump to content

Escape Room Command Center API

From Escape Room Supplier Wiki

Escape Room Command Center (ERCC) has a local REST API. The ERCC app serves it on port 4000, so the API works only while the app is running. Other devices on the same network reach it at:

http://<IP address of the PC running ERCC>:4000/api/v1

On the PC itself use http://localhost:4000/api/v1. Requests and responses use JSON (Content-Type: application/json).

Enabling the API

The API is on by default. To check it or switch it off, open the main program Settings and find the API section with the Enable API switch. While the API is off, every endpoint answers 403 {"error": "API is disabled"}.

With the API on, the Open API Documentation button opens the interactive documentation (http://localhost:4000/api/docs) in your browser. It lists every endpoint with its parameters and responses, and you can send test requests from it (Try it out → Execute). See also ERCC lesson - Enabling Disabling API.

How to turn on the API in ERCC.

Endpoints

All paths below are relative to http://<IP>:4000/api/v1. {id} is the room ID from GET /rooms; the other IDs come from the matching list endpoint of the room.

Status and rooms

Method Endpoint Description
GET /status App version, server connection, login state and number of rooms.
GET /rooms List of all rooms of the logged-in account (ID, name, duration, remaining time, help request, win).
GET /rooms/{id} One room with its current game: status (idle / running / paused / won / lost), current hint, hints used, extra time, team name, players, language and puzzle progress.

Game control

Method Endpoint Description
POST /rooms/{id}/timer/start Starts or resumes the countdown.
POST /rooms/{id}/timer/pause Pauses the countdown.
POST /rooms/{id}/timer/reset Resets the whole room for the next game, the same as Reset on the dashboard: the clock goes back to the full duration, the hint, extra time, hint counter, help request and team name are cleared, the room's puzzles are reset and a new game starts.
POST /rooms/{id}/timer/add Adds extra time. Body: {"minutes": 10}.
POST /rooms/{id}/timer/set Sets the remaining time, the same as Set time on the dashboard. Body: {"minutes": 15}. Time past the room duration counts as extra time. On a room that has not started yet, the clock is set but not started.
POST /rooms/{id}/timer/remove Takes time off the remaining time. Body: {"minutes": 5}. At least 1 second must remain: the API cannot end a game as lost.
POST /rooms/{id}/win Ends the game as won: stops the clock and records the win (and the leaderboard result, if a team name is set). ERCC records the win only while time remains in a started game; otherwise it just stops the clock.
POST /rooms/{id}/help/dismiss Clears the players' help request on the dashboard and re-enables the help button on the room screen.
POST /rooms/{id}/language Sets the room language. Body: {"language": "EN", "target": "all"}. language = default, EN, DE or ES; target = room (room screen only), devices (puzzles only) or all (both, default). See Multi-language rooms with ERCC and UUPC.

Hints

Method Endpoint Description
GET /rooms/{id}/hints The room's saved hints (ID, text, planned game minute, automatic sending, attached sound / image / video, linked puzzles).
POST /rooms/{id}/hint/send Sends a hint to the room screen. Free text: {"text": "Look under the carpet"} (this also clears the help request). Saved hint: {"hint_id": "<ID from GET /rooms/{id}/hints>"}; hint_id wins over text.
POST /rooms/{id}/hint/clear Clears the hint from the room screen.

Puzzles

Method Endpoint Description
GET /rooms/{id}/devices The room's puzzles and their state (online, last seen, solved, machine state, current step, help button, final puzzle).
POST /rooms/{id}/devices/{deviceId}/win Sets a puzzle to win, the same as the puzzle's Win button on the dashboard. A physical puzzle switches to its win state and reports back; a starting puzzle starts the game and the final puzzle ends it as won. A virtual puzzle changes in the app directly.
POST /rooms/{id}/devices/{deviceId}/reset Resets a puzzle, the same as the puzzle's Reset button: back to armed, manually changed inputs released.

Scenes and automations

Method Endpoint Description
GET /rooms/{id}/scenes The room's scenes (ID, name, number of puzzles, inputs and lights the scene sets).
POST /rooms/{id}/scenes/{sceneId}/activate Activates a scene: sets every puzzle, input and light of the scene. It runs in the background, so the answer means "started", not "finished".
GET /rooms/{id}/automations The room's automations (ID, name, enabled, triggers, actions).
POST /rooms/{id}/automations/{automationId}/enable Enables an automation, so it runs again when its triggers fire. ERCC saves the change right away.
POST /rooms/{id}/automations/{automationId}/disable Disables an automation, so it no longer runs when its triggers fire. ERCC saves the change right away.

Log and leaderboard

Method Endpoint Description
GET /rooms/{id}/log Events of the current game, oldest first (e.g. TIMER_STARTED, HINT_SENT, EXTRA_TIME, HELP_NEEDED, GAME_WON, GAME_LOST). A room reset starts a new game with an empty log. Events appear up to ~1.5 s after they happen.
GET /rooms/{id}/leaderboard The room's leaderboard, the same data as the leaderboard screen. Query parameters: period = all (default), month or year; limit = 3–100 (default 10). Only won games with a team name are ranked.

Responses and errors

Most POST endpoints answer {"success": true}. timer/set and timer/remove also return remaining_seconds; enable / disable return enabled. On an error the API answers with {"error": "<message>"} and one of these codes:

Code Meaning
400 Invalid request (e.g. missing or negative minutes, unknown language).
403 The API is switched off in Settings.
404 Room not found, or the puzzle / hint / scene / automation is not in this room.
409 The puzzle is offline.
502 The puzzle did not answer.

Examples

Get the rooms list:

curl http://192.168.1.10:4000/api/v1/rooms

Add 10 minutes to a room:

curl -X POST -H "Content-Type: application/json" -d "{\"minutes\": 10}" http://192.168.1.10:4000/api/v1/rooms/<room id>/timer/add

Send a hint:

curl -X POST -H "Content-Type: application/json" -d "{\"text\": \"Look under the carpet\"}" http://192.168.1.10:4000/api/v1/rooms/<room id>/hint/send

Changing state of virtual device

To change the state of a puzzle (also a virtual one) from another program, use POST /rooms/{id}/devices/{deviceId}/win and POST /rooms/{id}/devices/{deviceId}/reset (see Puzzles).

You can also send the device's machine state directly, the same way the puzzle controllers report to ERCC. Send a POST request to http://<IP>:4000/ (no /api/v1) with the virtual device ID and the machine state. You get the virtual device ID from the room settings in ERCC: click the device on the list.

Machine states

Machine State ID Description
ARMED 0 Game / prop is ready
IN PROGRESS 1 Users started solving game
WIN 2 User won that game
LEARNING 3 Game is learning new modes

Request data to send

{
  "id": "<virtual device id>",
  "universal_state": {
    "machine_state": "<selected machine state>"
  }
}